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.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=856270 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 856270 - Async UpdateCurrentDictionary</title> |
michael@0 | 8 | <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=856270">Mozilla Bug 856270</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content"> |
michael@0 | 15 | <textarea id="editor" spellcheck="true"></textarea> |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript;version=1.8"> |
michael@0 | 19 | |
michael@0 | 20 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 21 | addLoadEvent(start); |
michael@0 | 22 | |
michael@0 | 23 | function start() { |
michael@0 | 24 | Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm"); |
michael@0 | 25 | var textarea = document.getElementById("editor"); |
michael@0 | 26 | textarea.focus(); |
michael@0 | 27 | |
michael@0 | 28 | onSpellCheck(textarea, function () { |
michael@0 | 29 | var isc = textarea.editor.getInlineSpellChecker(false); |
michael@0 | 30 | ok(isc, "Inline spell checker should exist after focus and spell check"); |
michael@0 | 31 | var sc = isc.spellChecker; |
michael@0 | 32 | isnot(sc.GetCurrentDictionary(), lang, |
michael@0 | 33 | "Current dictionary should not be set yet."); |
michael@0 | 34 | |
michael@0 | 35 | // First, set the lang attribute on the textarea, call Update, and make |
michael@0 | 36 | // sure the spell checker's language was updated appropriately. |
michael@0 | 37 | var lang = "en-US"; |
michael@0 | 38 | textarea.setAttribute("lang", lang); |
michael@0 | 39 | sc.UpdateCurrentDictionary(function () { |
michael@0 | 40 | is(sc.GetCurrentDictionary(), lang, |
michael@0 | 41 | "UpdateCurrentDictionary should set the current dictionary."); |
michael@0 | 42 | |
michael@0 | 43 | // Second, make some Update calls, but then do a Set. The Set should |
michael@0 | 44 | // effectively cancel the Updates, but the Updates' callbacks should be |
michael@0 | 45 | // called nonetheless. |
michael@0 | 46 | var numCalls = 3; |
michael@0 | 47 | for (var i = 0; i < numCalls; i++) { |
michael@0 | 48 | sc.UpdateCurrentDictionary(function () { |
michael@0 | 49 | is(sc.GetCurrentDictionary(), "", |
michael@0 | 50 | "No dictionary should be active after Update."); |
michael@0 | 51 | if (--numCalls == 0) |
michael@0 | 52 | SimpleTest.finish(); |
michael@0 | 53 | }); |
michael@0 | 54 | } |
michael@0 | 55 | try { |
michael@0 | 56 | sc.SetCurrentDictionary("testing-XX"); |
michael@0 | 57 | } |
michael@0 | 58 | catch (err) { |
michael@0 | 59 | // Set throws NS_ERROR_NOT_AVAILABLE because "testing-XX" isn't really |
michael@0 | 60 | // an available dictionary. |
michael@0 | 61 | } |
michael@0 | 62 | is(sc.GetCurrentDictionary(), "", |
michael@0 | 63 | "No dictionary should be active after Set."); |
michael@0 | 64 | }); |
michael@0 | 65 | }); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | </script> |
michael@0 | 69 | </pre> |
michael@0 | 70 | </body> |
michael@0 | 71 | </html> |
michael@0 | 72 |