content/xul/templates/tests/chrome/test_tmpl_query3tripleswherecontains.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     5 <!--
     6   query - 3 triples - where contains
     7 -->
     9 <window title="XUL Template Tests" width="500" height="600"
    10         onload="test_template();"
    11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    12   <script type="application/javascript"
    13           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    15   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    17   <data id="output">
    18     <label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Robert likes Tarantulas"/>
    19     <label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="Robert likes African Elephants"/>
    20     <label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="Robert likes African Elephants"/>
    21   </data>
    23 <script src="templates_shared.js"/>
    25 <script>
    26 <![CDATA[
    27 SimpleTest.waitForExplicitFinish();
    29 var testid ="query - 3 triples - where contains";
    30 var queryType = "rdf";
    31 var isTreeBuilder = false;
    32 var needsOpen = false;
    33 var notWorkingYet = false;
    34 var notWorkingYetDynamic = false;
    35 var expectedOutput = document.getElementById("output");
    37 var changes = [
    38   // step 1
    39   function(targetds, root) {
    40     var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
    41     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    42                     RDF.GetLiteral('Arctic Hare'), true);
    43     var container = ContainerUtils.MakeSeq(targetds,
    44                       RDF.GetResource(ZOO_NS + 'mammals'));
    45     container.AppendElement(newnode);
    46   },
    47   // step 2
    48   function(targetds, root) {
    49     var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
    50     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    51                     RDF.GetLiteral('Koala'), true);
    52     var container = ContainerUtils.MakeSeq(targetds,
    53                       RDF.GetResource(ZOO_NS + 'mammals'));
    54     container.InsertElementAt(newnode, '4', true);
    55   },
    56   // step 3
    57   function(targetds, root) {
    58     var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
    59     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    60                     RDF.GetLiteral('Zebra'), true);
    61     var container = ContainerUtils.MakeSeq(targetds,
    62                       RDF.GetResource(ZOO_NS + 'mammals'));
    63     container.InsertElementAt(newnode, '1', true);
    64   },
    65   // step 4
    66   function(targetds, root) {
    67     var container = ContainerUtils.MakeSeq(targetds,
    68                       RDF.GetResource(ZOO_NS + 'mammals'));
    69     var removednode = container.RemoveElementAt('4', true);
    70     targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    71                       RDF.GetLiteral('African Elephant'), true);
    72   },
    73   // step 5
    74   function(targetds, root) {
    75     var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
    76     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    77                     RDF.GetLiteral('African Elephant'), true);
    78     var container = ContainerUtils.MakeSeq(targetds,
    79                       RDF.GetResource(ZOO_NS + 'mammals'));
    80     container.AppendElement(newnode);
    81   },
    82   // step 6
    83   function(targetds, root) {
    84     targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
    85                     RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
    86                     RDF.GetLiteral('8'), true);
    87   }
    88 ];
    89 ]]>
    90 </script>
    92 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/humans/robert">
    93 <template id="template">
    94 <query id="query">
    95 <content uri="?uri"/>
    96 <triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?humanname"/>
    97 <triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?favoriteAnimal"/>
    98 <triple subject="?favoriteAnimal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?animalname"/>
    99 </query>
   100 <rule>
   101 <conditions id="conditions">
   102 <where subject="?favoriteAnimal" rel="contains" value="ant"/>
   103 </conditions>
   104 <action>
   105 <label uri="?favoriteAnimal" value="?humanname likes ?animalname^s"/>
   106 </action>
   107 </rule>
   108 </template>
   109 </vbox>
   111 </window>

mercurial