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 <!doctype html>
2 <title>Selection Document.open() tests</title>
3 <div id=log></div>
4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script>
6 <script>
7 "use strict";
9 // This tests the HTML spec requirement "Replace the Document's singleton
10 // objects with new instances of those objects. (This includes in particular
11 // the Window, Location, History, ApplicationCache, and Navigator, objects, the
12 // various BarProp objects, the two Storage objects, the various HTMLCollection
13 // objects, and objects defined by other specifications, like Selection and the
14 // document's UndoManager. It also includes all the Web IDL prototypes in the
15 // JavaScript binding, including the Document object's prototype.)" in the
16 // document.open() algorithm.
18 var iframe = document.createElement("iframe");
19 var t = async_test("Selection must be replaced with a new object after document.open()");
20 iframe.onload = function() {
21 t.step(function() {
22 var originalSelection = iframe.contentWindow.getSelection();
23 assert_equals(originalSelection.rangeCount, 0,
24 "Sanity check: rangeCount must be initially 0");
25 iframe.contentDocument.body.appendChild(
26 iframe.contentDocument.createTextNode("foo"));
27 var range = iframe.contentDocument.createRange();
28 range.selectNodeContents(iframe.contentDocument.body);
29 iframe.contentWindow.getSelection().addRange(range);
30 assert_equals(originalSelection.rangeCount, 1,
31 "Sanity check: rangeCount must be 1 after adding a range");
33 iframe.contentDocument.open();
35 assert_not_equals(iframe.contentWindow.getSelection(), originalSelection,
36 "After document.open(), the Selection object must no longer be the same");
37 assert_equals(iframe.contentWindow.getSelection().rangeCount, 0,
38 "After document.open(), rangeCount must be 0 again");
39 });
40 t.done();
41 document.body.removeChild(iframe);
42 };
43 document.body.appendChild(iframe);
44 </script>