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 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=678842
5 -->
6 <head>
7 <title>Test for Bug 678842</title>
8 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
10 </head>
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=678842">Mozilla Bug 678842</a>
12 <p id="display"></p>
13 <iframe id="content"></iframe>
15 </div>
16 <pre id="test">
17 <script class="testbody" type="text/javascript">
19 /** Test for Bug 678842 **/
20 SimpleTest.waitForExplicitFinish();
21 var content = document.getElementById('content');
22 // load a subframe containing an editor with a defined unknown lang. At first
23 // load, it will set dictionary to en-US. At second load, it will return current
24 // dictionary. So, we can check, dictionary is correctly remembered between
25 // loads.
27 var firstLoad = true;
29 var loadListener = function(evt) {
30 Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
31 var doc = evt.target.contentDocument;
32 var elem = doc.getElementById('textarea');
33 var editor = elem.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
34 editor.setSpellcheckUserOverride(true);
35 var inlineSpellChecker = editor.getInlineSpellChecker(true);
37 onSpellCheck(elem, function () {
38 var spellchecker = inlineSpellChecker.spellChecker;
39 try {
40 var currentDictonary = spellchecker.GetCurrentDictionary();
41 } catch(e) {}
43 if (!currentDictonary) {
44 spellchecker.SetCurrentDictionary('en-US');
45 }
47 if (firstLoad) {
48 firstLoad = false;
49 is (currentDictonary, "", "unexpected lang " + currentDictonary);
50 content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug678842_subframe.html?firstload=false';
51 } else {
52 is (currentDictonary, "en-US", "unexpected lang " + currentDictonary + " instead of en-US");
53 content.removeEventListener('load', loadListener, false);
54 SimpleTest.finish();
55 }
56 });
57 }
59 content.addEventListener('load', loadListener, false);
61 content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug678842_subframe.html?firstload=true';
63 </script>
64 </pre>
65 </body>
66 </html>