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 queryset - two with condition
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 <hbox step="-6" id="http://www.some-fictitious-zoo.com/birds/emu">
19 <label value="Emu"/>
20 <label value="Dromaius novaehollandiae"/>
21 </hbox>
22 <button step="6" id="http://www.some-fictitious-zoo.com/birds/emu" label="No Emus Currently"/>
23 <hbox step="3" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
24 <label value="Archaeopteryx"/>
25 <label value="Archaeopteryx lithographica"/>
26 </hbox>
27 <hbox step="-2" id="http://www.some-fictitious-zoo.com/birds/barnowl">
28 <label value="Barn Owl"/>
29 <label value="Tyto alba"/>
30 </hbox>
31 <button step="-5" id="http://www.some-fictitious-zoo.com/birds/raven" label="No Ravens Currently"/>
32 <hbox step="5" id="http://www.some-fictitious-zoo.com/birds/raven">
33 <label step="-7" value="Raven"/>
34 <label step="7" value="Crow"/>
35 <label value="Corvus corax"/>
36 </hbox>
37 </data>
39 <script src="templates_shared.js"/>
41 <script>
42 <![CDATA[
43 SimpleTest.waitForExplicitFinish();
45 var testid ="queryset - two with condition";
46 var queryType = "rdf";
47 var isTreeBuilder = false;
48 var needsOpen = false;
49 var notWorkingYet = false;
50 var notWorkingYetDynamic = false;
51 var expectedOutput = document.getElementById("output");
53 var changes = [
54 // step 1
55 function(targetds, root) {
56 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
57 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
58 RDF.GetLiteral('Archaeopteryx'), true);
59 var container = ContainerUtils.MakeSeq(targetds,
60 RDF.GetResource(ZOO_NS + 'birds'));
61 container.InsertElementAt(newnode, '2', true);
62 },
63 // step 2
64 function(targetds, root) {
65 var container = ContainerUtils.MakeSeq(targetds,
66 RDF.GetResource(ZOO_NS + 'birds'));
67 var removednode = container.RemoveElementAt('3', true);
68 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
69 RDF.GetLiteral('Barn Owl'), true);
70 },
71 // step 3
72 function(targetds, root) {
73 targetds.Assert(RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'),
74 RDF.GetResource(ZOO_NS + 'rdf#species'),
75 RDF.GetLiteral('Archaeopteryx lithographica'), true);
76 },
77 // step 4
78 function(targetds, root) {
79 targetds.Assert(RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'),
80 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
81 RDF.GetLiteral('5'), true);
82 },
83 // step 5
84 function(targetds, root) {
85 var subject = RDF.GetResource(ZOO_NS + 'birds/raven');
86 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
87 var oldval = targetds.GetTarget(subject, predicate, true);
88 targetds.Change(RDF.GetResource(ZOO_NS + 'birds/raven'),
89 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
90 oldval, RDF.GetLiteral('2'));
91 },
92 // step 6
93 function(targetds, root) {
94 var subject = RDF.GetResource(ZOO_NS + 'birds/emu');
95 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
96 var oldval = targetds.GetTarget(subject, predicate, true);
97 targetds.Change(RDF.GetResource(ZOO_NS + 'birds/emu'),
98 RDF.GetResource(ZOO_NS + 'rdf#specimens'),
99 oldval, RDF.GetLiteral('0'));
100 },
101 // step 7
102 function(targetds, root) {
103 var subject = RDF.GetResource(ZOO_NS + 'birds/raven');
104 var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
105 var oldval = targetds.GetTarget(subject, predicate, true);
106 targetds.Change(RDF.GetResource(ZOO_NS + 'birds/raven'),
107 RDF.GetResource(ZOO_NS + 'rdf#name'),
108 oldval, RDF.GetLiteral('Crow'));
109 }
110 ];
111 ]]>
112 </script>
114 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
115 <template>
116 <queryset>
117 <query>
118 <content uri="?uri"/>
119 <member container="?uri" child="?child"/>
120 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
121 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
122 </query>
123 <rule>
124 <conditions>
125 <where subject="?specimens" rel="equals" value="0"/>
126 </conditions>
127 <action>
128 <button uri="?child" label="No ?name^s Currently"/>
129 </action>
130 </rule>
131 </queryset>
132 <queryset>
133 <query>
134 <content uri="?uri"/>
135 <member container="?uri" child="?child"/>
136 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
137 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#species" object="?species"/>
138 </query>
139 <action>
140 <hbox uri="?child">
141 <label value="?name^?unknown"/>
142 <label value="?species^?specimens"/>
143 </hbox>
144 </action>
145 </queryset>
146 </template>
147 </vbox>
149 </window>