content/xul/templates/tests/chrome/test_tmpl_htmlelementquerysyntaxwithmultiplerules.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   html element - query syntax with multiple rules
     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" xmlns:html="http://www.w3.org/1999/xhtml">
    18     <html:span step="-2" id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span>
    19     <html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span>
    20     <vbox>
    21       <html:p step="2" id="http://www.some-fictitious-zoo.com/mammals/lion">
    22         <html:span title="Lion"/>
    23       </html:p>
    24       <html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant">
    25         <html:span title="African Elephant"/>
    26       </html:p>
    27       <html:p step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">
    28         <html:span title="Polar Bear"/>
    29       </html:p>
    30       <html:p id="http://www.some-fictitious-zoo.com/mammals/gorilla">
    31         <html:span title="Gorilla"/>
    32       </html:p>
    33     </vbox>
    34     <html:span step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee">Chimpanzee</html:span>
    35     <html:span id="http://www.some-fictitious-zoo.com/mammals/llama">LLAMA</html:span>
    36     <html:span step="1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span>
    37     <html:span id="http://www.some-fictitious-zoo.com/mammals/aardvark">aardvark</html:span>
    38     <html:span step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span>
    39   </data>
    41 <script src="templates_shared.js"/>
    43 <script>
    44 <![CDATA[
    45 SimpleTest.waitForExplicitFinish();
    47 var testid ="html element - query syntax with multiple rules";
    48 var queryType = "rdf";
    49 var isTreeBuilder = false;
    50 var needsOpen = false;
    51 var notWorkingYet = true;
    52 var notWorkingYetDynamic = true;
    53 var expectedOutput = document.getElementById("output");
    55 var changes = [
    56   // step 1
    57   function(targetds, root) {
    58     var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
    59     var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
    60     var oldval = targetds.GetTarget(subject, predicate, true);
    61     targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
    62                     RDF.GetResource(ZOO_NS + 'rdf#specimens'),
    63                     oldval, RDF.GetLiteral('5'));
    64   },
    65   // step 2
    66   function(targetds, root) {
    67     var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
    68     var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
    69     var oldval = targetds.GetTarget(subject, predicate, true);
    70     targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
    71                     RDF.GetResource(ZOO_NS + 'rdf#specimens'),
    72                     oldval, RDF.GetLiteral('9'));
    73   },
    74   // step 3
    75   function(targetds, root) {
    76     var container = ContainerUtils.MakeSeq(targetds,
    77                       RDF.GetResource(ZOO_NS + 'mammals'));
    78     var removednode = container.RemoveElementAt('7', true);
    79     targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    80                       RDF.GetLiteral('Nine-banded Armadillo'), true);
    81   },
    82   // step 4
    83   function(targetds, root) {
    84     var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
    85     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    86                     RDF.GetLiteral('Chimpanzee'), true);
    87     var container = ContainerUtils.MakeSeq(targetds,
    88                       RDF.GetResource(ZOO_NS + 'mammals'));
    89     container.InsertElementAt(newnode, '4', true);
    90   },
    91   // step 5
    92   function(targetds, root) {
    93     targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
    94                     RDF.GetResource(ZOO_NS + 'rdf#specimens'),
    95                     RDF.GetLiteral('3'), true);
    96   }
    97 ];
    98 ]]>
    99 </script>
   101 <div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/mammals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><query><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></query><rule><conditions id="conditions"><where subject="?specimens" rel="greater" value="6"/></conditions><action><vbox><p xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><span title="?name"/></p></vbox></action></rule><rule><action><span xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></span></action></rule></template></div>
   102 </window>

mercurial