content/xul/templates/tests/chrome/test_tmpl_whereequalsmultiplenegation.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   where - equals multiple negation
     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 step="3" id="http://www.some-fictitious-zoo.com/mammals/zebra" value="Zebra"/>
    19     <label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
    20     <label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
    21     <label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
    22     <label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
    23     <label step="1" id="http://www.some-fictitious-zoo.com/mammals/arctichare" value="Arctic Hare"/>
    24     <label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
    25   </data>
    27 <script src="templates_shared.js"/>
    29 <script>
    30 <![CDATA[
    31 SimpleTest.waitForExplicitFinish();
    33 var testid ="where - equals multiple negation";
    34 var queryType = "rdf";
    35 var isTreeBuilder = false;
    36 var needsOpen = false;
    37 var notWorkingYet = false;
    38 var notWorkingYetDynamic = false;
    39 var expectedOutput = document.getElementById("output");
    41 var changes = [
    42   // step 1
    43   function(targetds, root) {
    44     var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
    45     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    46                     RDF.GetLiteral('Arctic Hare'), true);
    47     var container = ContainerUtils.MakeSeq(targetds,
    48                       RDF.GetResource(ZOO_NS + 'mammals'));
    49     container.AppendElement(newnode);
    50     expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/arctichare', true, true,
    51                          '1 matching rule 1');
    52   },
    53   // step 2
    54   function(targetds, root) {
    55     var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
    56     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    57                     RDF.GetLiteral('Koala'), true);
    58     var container = ContainerUtils.MakeSeq(targetds,
    59                       RDF.GetResource(ZOO_NS + 'mammals'));
    60     container.InsertElementAt(newnode, '4', true);
    61     expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/koala', true, false,
    62                          '1 (didn\'t match a rule)');
    63   },
    64   // step 3
    65   function(targetds, root) {
    66     var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
    67     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    68                     RDF.GetLiteral('Zebra'), true);
    69     var container = ContainerUtils.MakeSeq(targetds,
    70                       RDF.GetResource(ZOO_NS + 'mammals'));
    71     container.InsertElementAt(newnode, '1', true);
    72     expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/zebra', true, true,
    73                          '1 matching rule 1');
    74   },
    75   // step 4
    76   function(targetds, root) {
    77     var container = ContainerUtils.MakeSeq(targetds,
    78                       RDF.GetResource(ZOO_NS + 'mammals'));
    79     var removednode = container.RemoveElementAt('4', true);
    80     targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    81                       RDF.GetLiteral('African Elephant'), true);
    82     expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/africanelephant', false, true,
    83                          '1 (no new active query)');
    84   },
    85   // step 5
    86   function(targetds, root) {
    87     var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
    88     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    89                     RDF.GetLiteral('African Elephant'), true);
    90     var container = ContainerUtils.MakeSeq(targetds,
    91                       RDF.GetResource(ZOO_NS + 'mammals'));
    92     container.AppendElement(newnode);
    93     expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/africanelephant', true, true,
    94                          '1 matching rule 1');
    95   },
    96   // step 6
    97   function(targetds, root) {
    98     targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
    99                     RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
   100                     RDF.GetLiteral('8'), true);
   101   }
   102 ];
   103 ]]>
   104 </script>
   106 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" flags="logging"
   107       datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/mammals">
   108 <template id="template">
   109 <query id="query">
   110 <content uri="?uri"/>
   111 <member container="?uri" child="?animal"/>
   112 <triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
   113 </query>
   114 <rule>
   115 <conditions id="conditions">
   116 <where subject="?name" rel="equals" multiple="true" negate="true" value="Lion,aardvark,LLAMA,Gorilla,Koala"/>
   117 </conditions>
   118 <action id="action">
   119 <label uri="?animal" value="?name"/>
   120 </action>
   121 </rule>
   122 </template>
   123 </vbox>
   125 </window>

mercurial