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 | <?xml version="1.0"?> |
michael@0 | 2 | |
michael@0 | 3 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 6 | |
michael@0 | 7 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 8 | |
michael@0 | 9 | <window id="331215test" |
michael@0 | 10 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 11 | width="600" |
michael@0 | 12 | height="600" |
michael@0 | 13 | onload="SimpleTest.executeSoon(startTest);" |
michael@0 | 14 | title="331215 test"> |
michael@0 | 15 | |
michael@0 | 16 | <script type="application/javascript"><![CDATA[ |
michael@0 | 17 | const Ci = Components.interfaces; |
michael@0 | 18 | const Cc = Components.classes; |
michael@0 | 19 | const Cr = Components.results; |
michael@0 | 20 | |
michael@0 | 21 | var gFindBar = null; |
michael@0 | 22 | var gBrowser; |
michael@0 | 23 | |
michael@0 | 24 | var imports = ["SimpleTest", "ok"]; |
michael@0 | 25 | for each (var name in imports) { |
michael@0 | 26 | window[name] = window.opener.wrappedJSObject[name]; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function finish() { |
michael@0 | 30 | window.close(); |
michael@0 | 31 | SimpleTest.finish(); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function startTest() { |
michael@0 | 35 | gFindBar = document.getElementById("FindToolbar"); |
michael@0 | 36 | gBrowser = document.getElementById("content"); |
michael@0 | 37 | gBrowser.addEventListener("pageshow", onPageShow, false); |
michael@0 | 38 | gBrowser.loadURI("data:text/plain,latest"); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function onPageShow() { |
michael@0 | 42 | document.getElementById("cmd_find").doCommand(); |
michael@0 | 43 | enterStringIntoFindField("test"); |
michael@0 | 44 | document.commandDispatcher |
michael@0 | 45 | .getControllerForCommand("cmd_moveTop") |
michael@0 | 46 | .doCommand("cmd_moveTop"); |
michael@0 | 47 | enterStringIntoFindField("l"); |
michael@0 | 48 | ok(gFindBar._findField.getAttribute("status") == "notfound", |
michael@0 | 49 | "Findfield status attribute should have been 'notfound'" + |
michael@0 | 50 | " after entering ltest"); |
michael@0 | 51 | enterStringIntoFindField("a"); |
michael@0 | 52 | ok(gFindBar._findField.getAttribute("status") != "notfound", |
michael@0 | 53 | "Findfield status attribute should not have been 'notfound'" + |
michael@0 | 54 | " after entering latest"); |
michael@0 | 55 | finish(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | function enterStringIntoFindField(aString) { |
michael@0 | 59 | for (var i=0; i < aString.length; i++) { |
michael@0 | 60 | var event = document.createEvent("KeyEvents"); |
michael@0 | 61 | event.initKeyEvent("keypress", true, true, null, false, false, |
michael@0 | 62 | false, false, 0, aString.charCodeAt(i)); |
michael@0 | 63 | gFindBar._findField.inputField.dispatchEvent(event); |
michael@0 | 64 | } |
michael@0 | 65 | } |
michael@0 | 66 | ]]></script> |
michael@0 | 67 | |
michael@0 | 68 | <commandset> |
michael@0 | 69 | <command id="cmd_find" oncommand="document.getElementById('FindToolbar').onFindCommand();"/> |
michael@0 | 70 | </commandset> |
michael@0 | 71 | <browser type="content-primary" flex="1" id="content" src="about:blank"/> |
michael@0 | 72 | <findbar id="FindToolbar" browserid="content"/> |
michael@0 | 73 | </window> |