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.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 4
michael@0 5 <!--
michael@0 6 html element - query syntax with multiple rules
michael@0 7 -->
michael@0 8
michael@0 9 <window title="XUL Template Tests" width="500" height="600"
michael@0 10 onload="test_template();"
michael@0 11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 12 <script type="application/javascript"
michael@0 13 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 14
michael@0 15 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
michael@0 16
michael@0 17 <data id="output" xmlns:html="http://www.w3.org/1999/xhtml">
michael@0 18 <html:span step="-2" id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span>
michael@0 19 <html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span>
michael@0 20 <vbox>
michael@0 21 <html:p step="2" id="http://www.some-fictitious-zoo.com/mammals/lion">
michael@0 22 <html:span title="Lion"/>
michael@0 23 </html:p>
michael@0 24 <html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant">
michael@0 25 <html:span title="African Elephant"/>
michael@0 26 </html:p>
michael@0 27 <html:p step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">
michael@0 28 <html:span title="Polar Bear"/>
michael@0 29 </html:p>
michael@0 30 <html:p id="http://www.some-fictitious-zoo.com/mammals/gorilla">
michael@0 31 <html:span title="Gorilla"/>
michael@0 32 </html:p>
michael@0 33 </vbox>
michael@0 34 <html:span step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee">Chimpanzee</html:span>
michael@0 35 <html:span id="http://www.some-fictitious-zoo.com/mammals/llama">LLAMA</html:span>
michael@0 36 <html:span step="1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span>
michael@0 37 <html:span id="http://www.some-fictitious-zoo.com/mammals/aardvark">aardvark</html:span>
michael@0 38 <html:span step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span>
michael@0 39 </data>
michael@0 40
michael@0 41 <script src="templates_shared.js"/>
michael@0 42
michael@0 43 <script>
michael@0 44 <![CDATA[
michael@0 45 SimpleTest.waitForExplicitFinish();
michael@0 46
michael@0 47 var testid ="html element - query syntax with multiple rules";
michael@0 48 var queryType = "rdf";
michael@0 49 var isTreeBuilder = false;
michael@0 50 var needsOpen = false;
michael@0 51 var notWorkingYet = true;
michael@0 52 var notWorkingYetDynamic = true;
michael@0 53 var expectedOutput = document.getElementById("output");
michael@0 54
michael@0 55 var changes = [
michael@0 56 // step 1
michael@0 57 function(targetds, root) {
michael@0 58 var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
michael@0 59 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
michael@0 60 var oldval = targetds.GetTarget(subject, predicate, true);
michael@0 61 targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
michael@0 62 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
michael@0 63 oldval, RDF.GetLiteral('5'));
michael@0 64 },
michael@0 65 // step 2
michael@0 66 function(targetds, root) {
michael@0 67 var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
michael@0 68 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
michael@0 69 var oldval = targetds.GetTarget(subject, predicate, true);
michael@0 70 targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
michael@0 71 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
michael@0 72 oldval, RDF.GetLiteral('9'));
michael@0 73 },
michael@0 74 // step 3
michael@0 75 function(targetds, root) {
michael@0 76 var container = ContainerUtils.MakeSeq(targetds,
michael@0 77 RDF.GetResource(ZOO_NS + 'mammals'));
michael@0 78 var removednode = container.RemoveElementAt('7', true);
michael@0 79 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 80 RDF.GetLiteral('Nine-banded Armadillo'), true);
michael@0 81 },
michael@0 82 // step 4
michael@0 83 function(targetds, root) {
michael@0 84 var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
michael@0 85 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 86 RDF.GetLiteral('Chimpanzee'), true);
michael@0 87 var container = ContainerUtils.MakeSeq(targetds,
michael@0 88 RDF.GetResource(ZOO_NS + 'mammals'));
michael@0 89 container.InsertElementAt(newnode, '4', true);
michael@0 90 },
michael@0 91 // step 5
michael@0 92 function(targetds, root) {
michael@0 93 targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
michael@0 94 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
michael@0 95 RDF.GetLiteral('3'), true);
michael@0 96 }
michael@0 97 ];
michael@0 98 ]]>
michael@0 99 </script>
michael@0 100
michael@0 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>
michael@0 102 </window>

mercurial