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 type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=658909
6 -->
7 <window title="Mozilla Bug 658909"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=658909"
14 target="_blank">Mozilla Bug 658909</a>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
20 /** Test for call/apply-ing Xray methods.**/
21 SimpleTest.waitForExplicitFinish();
23 gLoadCount = 0;
24 function frameLoaded() {
25 if (++gLoadCount == frames.length)
26 go();
27 }
29 function msg(a, b, testName) {
30 return "(" + a.name + ", " + b.name + "): " + testName;
31 }
33 var testFunctions = {
34 testDocumentElement: function(a, b, name) {
35 var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement');
36 is(getter.call(b.document), b.document.documentElement, msg(a, b, name));
37 },
39 testInvalidCall: function(a, b, name) {
40 var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement');
41 var threw = false;
42 try { getter.call(b.document.body); } catch (e) { threw = true; };
43 ok(threw, msg(a, b, name));
44 },
46 testStatus: function(a, b, name) {
47 var setter = Object.prototype.__lookupSetter__.call(a, 'status');
48 is(b.status, "", "Empty status");
49 setter.call(b, "foopy");
50 is(b.status, "foopy", msg(a, b, name));
51 b.status = "";
52 },
54 testCreateElement: function(a, b, name) {
55 is(a.document.createElement.call(b.document, 'div').ownerDocument, b.document, msg(a, b, name));
56 },
58 testWindowName: function(a, b, name) {
59 var getter = Object.prototype.__lookupGetter__.call(a, 'name');
60 is(getter.call(b), b.name, msg(a, b, name));
61 },
63 testCanvas: function(a, b, name) {
64 var canvasA = a.document.createElement('canvas');
65 var canvasB = b.document.createElement('canvas');
66 var contextA = canvasA.getContext('2d');
67 var contextB = canvasB.getContext('2d');
68 var getter = Object.prototype.__lookupGetter__.call(contextA, 'canvas');
69 is(getter.call(contextB), canvasB, msg(a, b, name));
70 }
71 };
73 function go() {
74 for (var i = 0; i < frames.length; ++i)
75 frames[i].name = 'frame' + i;
76 for (var i = 0; i < frames.length; ++i) {
77 for (var j = 0; j < frames.length; ++j) {
78 for (var k in testFunctions)
79 testFunctions[k](frames[i], frames[j], k);
80 }
81 }
83 SimpleTest.finish();
84 }
87 ]]>
88 </script>
89 <iframe id="frame1" onload="frameLoaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
90 <iframe id="frame2" onload="frameLoaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
91 <iframe id="frame3" onload="frameLoaded();" type="content" src="http://example.com/tests/js/xpconnect/tests/mochitest/file_empty.html" />
92 </window>