content/xul/templates/tests/chrome/test_bug441785.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 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 6 <tree flex="20" id="t" ref="urn:data:row" datasources="rdf:null" seltype="single">
michael@0 7 <treecols>
michael@0 8 <treecol flex="1" id="id" label="id" sort="rdf:http://dummy/rdf#id" />
michael@0 9 <splitter class="tree-splitter"/>
michael@0 10 <treecol flex="1" id="title" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
michael@0 11 </treecols>
michael@0 12 <template>
michael@0 13 <treechildren>
michael@0 14 <treeitem uri="rdf:*" seltype="single">
michael@0 15 <treerow >
michael@0 16 <treecell label="rdf:http://dummy/rdf#id"/>
michael@0 17 <treecell label="rdf:http://dummy/rdf#title"/>
michael@0 18 </treerow>
michael@0 19 </treeitem>
michael@0 20 </treechildren>
michael@0 21 </template>
michael@0 22 </tree>
michael@0 23 <tree flex="20" id="tc" ref="urn:data:row" datasources="rdf:null" seltype="single" flags="dont-build-content">
michael@0 24 <treecols>
michael@0 25 <treecol flex="1" id="idc" label="id" sort="rdf:http://dummy/rdf#id" />
michael@0 26 <splitter class="tree-splitter"/>
michael@0 27 <treecol flex="1" id="titlec" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
michael@0 28 </treecols>
michael@0 29 <template>
michael@0 30 <treechildren>
michael@0 31 <treeitem uri="rdf:*" seltype="single">
michael@0 32 <treerow >
michael@0 33 <treecell label="rdf:http://dummy/rdf#id"/>
michael@0 34 <treecell label="rdf:http://dummy/rdf#title"/>
michael@0 35 </treerow>
michael@0 36 </treeitem>
michael@0 37 </treechildren>
michael@0 38 </template>
michael@0 39 </tree>
michael@0 40
michael@0 41 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
michael@0 42
michael@0 43 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 44
michael@0 45 <script type="application/x-javascript">
michael@0 46 <![CDATA[
michael@0 47
michael@0 48 var buildCount = 0;
michael@0 49
michael@0 50 SimpleTest.waitForExplicitFinish();
michael@0 51
michael@0 52 var TemplateBuilderListener = {
michael@0 53 willRebuild: function(aBuilder) {
michael@0 54 },
michael@0 55
michael@0 56 didRebuild: function(aBuilder) {
michael@0 57 ++buildCount;
michael@0 58 var remove = false;
michael@0 59 if (buildCount == 2) {
michael@0 60 remove =true;
michael@0 61 setTimeout(nextDataSource, 0);
michael@0 62 } else if (buildCount == 4) {
michael@0 63 remove = true;
michael@0 64 setTimeout(continueTest, 0);
michael@0 65 }
michael@0 66 if (remove) {
michael@0 67 var tree = document.getElementById('t');
michael@0 68 var treec = document.getElementById('tc');
michael@0 69 tree.builder.removeListener(TemplateBuilderListener);
michael@0 70 treec.builder.removeListener(TemplateBuilderListener);
michael@0 71 }
michael@0 72 },
michael@0 73
michael@0 74 QueryInterface: function (aIID)
michael@0 75 {
michael@0 76 if (!aIID.equals(Components.interfaces.nsIXULBuilderListener) &&
michael@0 77 !aIID.equals(Components.interfaces.nsISupports))
michael@0 78 throw Components.results.NS_ERROR_NO_INTERFACE;
michael@0 79 return this;
michael@0 80 }
michael@0 81 };
michael@0 82
michael@0 83 function runTest() {
michael@0 84 var tree = document.getElementById('t');
michael@0 85 var treec = document.getElementById('tc');
michael@0 86
michael@0 87 try {
michael@0 88 var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
michael@0 89 getService(Components.interfaces.nsIRDFService);
michael@0 90
michael@0 91 var s1 = window.location.href.replace(/test_bug441785.xul/, "bug441785-1.rdf");
michael@0 92 var ds1 = rdfService.GetDataSourceBlocking(s1);
michael@0 93
michael@0 94 var s2 = window.location.href.replace(/test_bug441785.xul/, "bug441785-2.rdf");
michael@0 95 var ds2 = rdfService.GetDataSourceBlocking(s2);
michael@0 96 } catch (ex) { }
michael@0 97
michael@0 98 tree.builder.addListener(TemplateBuilderListener);
michael@0 99 treec.builder.addListener(TemplateBuilderListener);
michael@0 100 tree.setAttribute('datasources', 'bug441785-1.rdf');
michael@0 101 treec.setAttribute('datasources', 'bug441785-1.rdf');
michael@0 102 }
michael@0 103
michael@0 104 var oldtreefirstrow, oldtreecfirstrow;
michael@0 105
michael@0 106 function nextDataSource()
michael@0 107 {
michael@0 108 var tree = document.getElementById('t');
michael@0 109 var treec = document.getElementById('tc');
michael@0 110 tree.treeBoxObject.scrollToRow(10);
michael@0 111 treec.treeBoxObject.scrollToRow(10);
michael@0 112
michael@0 113 is(tree.treeBoxObject.getFirstVisibleRow(), 10, "first tree row count datasource 1");
michael@0 114 is(treec.treeBoxObject.getFirstVisibleRow(), 10, "second tree row count datasource 1");
michael@0 115
michael@0 116 tree.builder.addListener(TemplateBuilderListener);
michael@0 117 treec.builder.addListener(TemplateBuilderListener);
michael@0 118 tree.setAttribute('datasources', 'bug441785-2.rdf');
michael@0 119 treec.setAttribute('datasources', 'bug441785-2.rdf');
michael@0 120 }
michael@0 121
michael@0 122 function continueTest() {
michael@0 123 var tree = document.getElementById('t');
michael@0 124 var treec = document.getElementById('tc');
michael@0 125
michael@0 126 is(tree.treeBoxObject.getFirstVisibleRow(), 0, "first tree row count datasource 2");
michael@0 127 is(treec.treeBoxObject.getFirstVisibleRow(), 0, "second tree row count datasource 2");
michael@0 128
michael@0 129 try {
michael@0 130 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 131 .getInterface(Components.interfaces.nsIDOMWindowUtils)
michael@0 132 .garbageCollect();
michael@0 133 }
michael@0 134 catch (e) { }
michael@0 135
michael@0 136 // Hit the bug, crash
michael@0 137 // (not exactly the same kind of crash as 441785, but from the same cause)
michael@0 138 tree.parentNode.removeChild(tree);
michael@0 139 treec.parentNode.removeChild(treec);
michael@0 140
michael@0 141 SimpleTest.finish();
michael@0 142 }
michael@0 143
michael@0 144 window.addEventListener("load", runTest, false);
michael@0 145
michael@0 146 ]]>
michael@0 147 </script>
michael@0 148 </window>

mercurial