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