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