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="263683test" |
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="263683 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/html,<h2>Text mozilla</h2><input id="inp" type="text" />'); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function onPageShow() { |
michael@0 | 42 | gFindBar.open(); |
michael@0 | 43 | var search = "mozilla"; |
michael@0 | 44 | gFindBar._findField.value = search; |
michael@0 | 45 | var matchCase = gFindBar.getElement("find-case-sensitive"); |
michael@0 | 46 | if (matchCase.checked) |
michael@0 | 47 | matchCase.doCommand(); |
michael@0 | 48 | |
michael@0 | 49 | gFindBar._find(); |
michael@0 | 50 | var highlightButton = gFindBar.getElement("highlight"); |
michael@0 | 51 | if (!highlightButton.checked) |
michael@0 | 52 | highlightButton.click(); |
michael@0 | 53 | |
michael@0 | 54 | var controller = gFindBar.browser.docShell.QueryInterface(Ci.nsIInterfaceRequestor) |
michael@0 | 55 | .getInterface(Ci.nsISelectionDisplay) |
michael@0 | 56 | .QueryInterface(Ci.nsISelectionController); |
michael@0 | 57 | ok('SELECTION_FIND' in controller, "Correctly detects new selection type"); |
michael@0 | 58 | var selection = controller.getSelection(controller.SELECTION_FIND); |
michael@0 | 59 | |
michael@0 | 60 | ok(selection.rangeCount == 1, "Correctly added a match to the selection type"); |
michael@0 | 61 | ok(selection.getRangeAt(0).toString().toLowerCase() == search, "Added the correct match"); |
michael@0 | 62 | highlightButton.click(); |
michael@0 | 63 | ok(selection.rangeCount == 0, "Correctly removed the range"); |
michael@0 | 64 | |
michael@0 | 65 | var input = gBrowser.contentDocument.getElementById("inp"); |
michael@0 | 66 | input.value = search; |
michael@0 | 67 | |
michael@0 | 68 | highlightButton.click(); |
michael@0 | 69 | |
michael@0 | 70 | var inputController = input.editor.selectionController; |
michael@0 | 71 | var inputSelection = inputController.getSelection(inputController.SELECTION_FIND); |
michael@0 | 72 | |
michael@0 | 73 | ok(inputSelection.rangeCount == 1, "Correctly added a match from input to the selection type"); |
michael@0 | 74 | ok(inputSelection.getRangeAt(0).toString().toLowerCase() == search, "Added the correct match"); |
michael@0 | 75 | highlightButton.click(); |
michael@0 | 76 | ok(inputSelection.rangeCount == 0, "Correctly removed the range"); |
michael@0 | 77 | finish(); |
michael@0 | 78 | } |
michael@0 | 79 | ]]></script> |
michael@0 | 80 | |
michael@0 | 81 | <browser type="content-primary" flex="1" id="content" src="about:blank"/> |
michael@0 | 82 | <findbar id="FindToolbar" browserid="content"/> |
michael@0 | 83 | </window> |