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

mercurial