content/xul/templates/tests/chrome/test_tmpl_treeelementquerysyntaxrecursivemultiplerulestreebuilder.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 tree element - query syntax recursive multiple rules tree builder
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">
michael@0 18 <treecols id="treecols" orient="horizontal">
michael@0 19 <treecol id="treecol" primary="true" label="Name" ordinal="1"/>
michael@0 20 <treecol label="Species" ordinal="3"/>
michael@0 21 </treecols>
michael@0 22 <treechildren>
michael@0 23 <treeitem id="http://www.some-fictitious-zoo.com/humans/sarah">
michael@0 24 <treerow>
michael@0 25 <treecell label="Sarah"/>
michael@0 26 <treecell/>
michael@0 27 </treerow>
michael@0 28 </treeitem>
michael@0 29 <treeitem step="-1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
michael@0 30 <treerow>
michael@0 31 <treecell/>
michael@0 32 <treecell label="Is this cool: Mammals?"/>
michael@0 33 </treerow>
michael@0 34 </treeitem>
michael@0 35 <treeitem step="1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" open="true">
michael@0 36 <treerow>
michael@0 37 <treecell/>
michael@0 38 <treecell label="Is this cool: Mammals?"/>
michael@0 39 </treerow>
michael@0 40 <treechildren>
michael@0 41 <treeitem id="http://www.some-fictitious-zoo.com/mammals/lion">
michael@0 42 <treerow>
michael@0 43 <treecell/>
michael@0 44 <treecell label="Is this cool: Lion?"/>
michael@0 45 </treerow>
michael@0 46 </treeitem>
michael@0 47 <treeitem id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">
michael@0 48 <treerow>
michael@0 49 <treecell label="HIPPOPOTAMUS"/>
michael@0 50 <treecell/>
michael@0 51 </treerow>
michael@0 52 </treeitem>
michael@0 53 <treeitem id="http://www.some-fictitious-zoo.com/mammals/africanelephant">
michael@0 54 <treerow>
michael@0 55 <treecell/>
michael@0 56 <treecell label="Is this cool: African Elephant?"/>
michael@0 57 </treerow>
michael@0 58 </treeitem>
michael@0 59 <treeitem step="2" id="http://www.some-fictitious-zoo.com/mammals/koala">
michael@0 60 <treerow>
michael@0 61 <treecell/>
michael@0 62 <treecell label="Is this cool: Koala?"/>
michael@0 63 </treerow>
michael@0 64 </treeitem>
michael@0 65 <treeitem id="http://www.some-fictitious-zoo.com/mammals/llama">
michael@0 66 <treerow>
michael@0 67 <treecell/>
michael@0 68 <treecell label="Is this cool: LLAMA?"/>
michael@0 69 </treerow>
michael@0 70 </treeitem>
michael@0 71 <treeitem id="http://www.some-fictitious-zoo.com/mammals/polarbear">
michael@0 72 <treerow>
michael@0 73 <treecell/>
michael@0 74 <treecell label="Is this cool: Polar Bear?"/>
michael@0 75 </treerow>
michael@0 76 </treeitem>
michael@0 77 <treeitem id="http://www.some-fictitious-zoo.com/mammals/aardvark">
michael@0 78 <treerow>
michael@0 79 <treecell label="aardvark"/>
michael@0 80 <treecell/>
michael@0 81 </treerow>
michael@0 82 </treeitem>
michael@0 83 <treeitem id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">
michael@0 84 <treerow>
michael@0 85 <treecell/>
michael@0 86 <treecell label="Is this cool: Nine-banded Armadillo?"/>
michael@0 87 </treerow>
michael@0 88 </treeitem>
michael@0 89 <treeitem id="http://www.some-fictitious-zoo.com/mammals/gorilla">
michael@0 90 <treerow>
michael@0 91 <treecell/>
michael@0 92 <treecell label="Is this cool: Gorilla?"/>
michael@0 93 </treerow>
michael@0 94 </treeitem>
michael@0 95 </treechildren>
michael@0 96 </treeitem>
michael@0 97 <treeitem step="-3" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
michael@0 98 <treerow>
michael@0 99 <treecell label="Crustaceans"/>
michael@0 100 <treecell/>
michael@0 101 </treerow>
michael@0 102 </treeitem>
michael@0 103 <treeitem step="3,-4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="false">
michael@0 104 <treerow>
michael@0 105 <treecell label="Crustaceans"/>
michael@0 106 <treecell/>
michael@0 107 </treerow>
michael@0 108 </treeitem>
michael@0 109 <treeitem step="4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="false" open="true">
michael@0 110 <treerow>
michael@0 111 <treecell label="Crustaceans"/>
michael@0 112 <treecell/>
michael@0 113 </treerow>
michael@0 114 <treechildren>
michael@0 115 <treeitem id="http://www.some-fictitious-zoo.com/crustaceans/lobster">
michael@0 116 <treerow>
michael@0 117 <treecell/>
michael@0 118 <treecell label="Is this cool: Lobster?"/>
michael@0 119 </treerow>
michael@0 120 </treeitem>
michael@0 121 </treechildren>
michael@0 122 </treeitem>
michael@0 123 <treeitem id="http://www.some-fictitious-zoo.com/birds/emu">
michael@0 124 <treerow>
michael@0 125 <treecell label="Emu"/>
michael@0 126 <treecell/>
michael@0 127 </treerow>
michael@0 128 </treeitem>
michael@0 129 </treechildren>
michael@0 130 </data>
michael@0 131
michael@0 132 <script src="templates_shared.js"/>
michael@0 133
michael@0 134 <script>
michael@0 135 <![CDATA[
michael@0 136 SimpleTest.waitForExplicitFinish();
michael@0 137
michael@0 138 var testid ="tree element - query syntax recursive multiple rules tree builder";
michael@0 139 var queryType = "rdf";
michael@0 140 var isTreeBuilder = true;
michael@0 141 var needsOpen = false;
michael@0 142 var notWorkingYet = false;
michael@0 143 var notWorkingYetDynamic = true;
michael@0 144 var expectedOutput = document.getElementById("output");
michael@0 145
michael@0 146 var changes = [
michael@0 147 // step 1
michael@0 148 function(targetds, root) {
michael@0 149 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1))
michael@0 150 root.view.toggleOpenState(1);
michael@0 151 },
michael@0 152 // step 2
michael@0 153 function(targetds, root) {
michael@0 154 var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
michael@0 155 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 156 RDF.GetLiteral('Koala'), true);
michael@0 157 var container = ContainerUtils.MakeSeq(targetds,
michael@0 158 RDF.GetResource(ZOO_NS + 'mammals'));
michael@0 159 container.InsertElementAt(newnode, '4', true);
michael@0 160 },
michael@0 161 // step 3
michael@0 162 function(targetds, root) {
michael@0 163 var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/lobster');
michael@0 164 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 165 RDF.GetLiteral('Lobster'), true);
michael@0 166 var container = ContainerUtils.MakeSeq(targetds,
michael@0 167 RDF.GetResource(ZOO_NS + 'crustaceans'));
michael@0 168 container.AppendElement(newnode);
michael@0 169 },
michael@0 170 // step 4
michael@0 171 function(targetds, root) {
michael@0 172 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11))
michael@0 173 root.view.toggleOpenState(11);
michael@0 174 },
michael@0 175 // step 5
michael@0 176 function(targetds, root) {
michael@0 177 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11))
michael@0 178 root.view.toggleOpenState(11);
michael@0 179 },
michael@0 180 // step 6
michael@0 181 function(targetds, root) {
michael@0 182 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1))
michael@0 183 root.view.toggleOpenState(1);
michael@0 184 }
michael@0 185 ];
michael@0 186 ]]>
michael@0 187 </script>
michael@0 188
michael@0 189 <tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" hidevscroll="true" hidehscroll="true" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/marked" flags=" dont-build-content" id="root">
michael@0 190 <treecols orient="horizontal" id="treecols">
michael@0 191 <treecol id="treecol" primary="true" label="Name"/>
michael@0 192 <treecol label="Species"/>
michael@0 193 </treecols>
michael@0 194 <template id="template">
michael@0 195 <query>
michael@0 196 <content uri="?uri"/>
michael@0 197 <member container="?uri" child="?child"/>
michael@0 198 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
michael@0 199 </query>
michael@0 200 <rule>
michael@0 201 <conditions>
michael@0 202 <where subject="?name" rel="contains" value="l" ignorecase="true"/>
michael@0 203 </conditions>
michael@0 204 <action>
michael@0 205 <treechildren>
michael@0 206 <treeitem uri="?child">
michael@0 207 <treerow>
michael@0 208 <treecell/>
michael@0 209 <treecell label="Is this cool: ?name^??"/>
michael@0 210 </treerow>
michael@0 211 </treeitem>
michael@0 212 </treechildren>
michael@0 213 </action>
michael@0 214 </rule>
michael@0 215 <rule>
michael@0 216 <action>
michael@0 217 <treechildren>
michael@0 218 <treeitem uri="?child">
michael@0 219 <treerow>
michael@0 220 <treecell label="?name"/>
michael@0 221 <treecell/>
michael@0 222 </treerow>
michael@0 223 </treeitem>
michael@0 224 </treechildren>
michael@0 225 </action>
michael@0 226 </rule>
michael@0 227 </template>
michael@0 228 </tree>
michael@0 229
michael@0 230 </window>

mercurial