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"
3 type="text/css"?>
4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
5 type="text/css"?>
6 <!--
7 https://bugzilla.mozilla.org/show_bug.cgi?id=599983
8 -->
9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 title="Mozilla Bug 599983" onload="runTest()">
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
13 <script type="application/javascript"
14 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
16 <body xmlns="http://www.w3.org/1999/xhtml">
17 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=599983"
18 target="_blank">Mozilla Bug 599983</a>
19 <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
20 id="editor"
21 editortype="html"
22 src="about:blank" />
23 </body>
24 <script type="application/javascript">
25 <![CDATA[
27 SimpleTest.waitForExplicitFinish();
29 const kAllowInteraction = Components.interfaces.nsIPlaintextEditor
30 .eEditorAllowInteraction;
31 const kMailMask = Components.interfaces.nsIPlaintextEditor.eEditorMailMask;
33 function runTest() {
34 testEditor(false, false);
35 testEditor(false, true);
36 testEditor(true, false);
37 testEditor(true, true);
39 SimpleTest.finish();
40 }
42 function testEditor(setAllowInteraction, setMailMask) {
43 var desc = " with " + (setAllowInteraction ? "" : "no ") +
44 "eEditorAllowInteraction and " +
45 (setMailMask ? "" : "no ") + "eEditorMailMask";
47 var editorElem = document.getElementById("editor");
49 var editorObj = editorElem.getEditor(editorElem.contentWindow);
50 editorObj.flags = (setAllowInteraction ? kAllowInteraction : 0) |
51 (setMailMask ? kMailMask : 0);
53 var editorDoc = editorElem.contentDocument;
54 editorDoc.body.innerHTML = "<p>foo<p>bar";
55 editorDoc.getSelection().selectAllChildren(editorDoc.body.firstChild);
56 editorDoc.execCommand("bold");
58 var createsDirty = !setAllowInteraction || setMailMask;
60 (createsDirty ? isnot : is)(editorDoc.querySelector("[_moz_dirty]"), null,
61 "Elements with _moz_dirty" + desc);
63 // Even if we do create _moz_dirty, we should strip it for innerHTML.
64 is(editorDoc.body.innerHTML, "<p><b>foo</b></p><p>bar</p>",
65 "innerHTML" + desc);
66 }
68 ]]>
69 </script>
70 </window>