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 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const Ci = Components.interfaces;
7 let tab, browser;
9 function test () {
10 waitForExplicitFinish();
12 tab = gBrowser.addTab("data:text/html;base64," +
13 btoa("<body><iframe srcdoc=\"content\"/></iframe>" +
14 "<a href=\"http://test.com\">test link</a>"));
15 browser = gBrowser.getBrowserForTab(tab);
16 gBrowser.selectedTab = tab;
18 browser.addEventListener("load", startTests, true);
19 }
21 var outlineTest = "sendAsyncMessage(\"OutlineTest\", " +
22 "{ ok : !!content.document." +
23 "getElementsByTagName(\"a\")[0].style.outline }" +
24 ");";
26 function startTests () {
27 browser.removeEventListener("load", startTests, true);
29 let finder = browser.finder;
30 let listener = {
31 onFindResult: function () {
32 ok(false, "callback wasn't replaced");
33 }
34 };
35 finder.addResultListener(listener);
37 listener.onFindResult = function ({result}) {
38 ok(result == Ci.nsITypeAheadFind.FIND_FOUND, "should find string");
40 listener.onFindResult = function ({result}) {
41 ok(result == Ci.nsITypeAheadFind.FIND_NOTFOUND, "should not find string");
43 let first = true;
44 listener.onFindResult = function ({result}) {
45 ok(result == Ci.nsITypeAheadFind.FIND_FOUND, "should find link");
47 browser.messageManager.addMessageListener("OutlineTest", function f(aMessage) {
48 browser.messageManager.removeMessageListener("OutlineTest", f);
51 if (first) {
52 ok(aMessage.data.ok, "content script should send okay");
53 first = false;
55 // Just a simple search for "test link".
56 finder.fastFind("test link", false, false);
57 } else {
58 ok(!aMessage.data.ok, "content script should not send okay");
59 cleanup();
60 }
61 })
62 browser.messageManager.loadFrameScript("data:," + outlineTest, false)
63 }
64 // Search only for links and draw outlines.
65 finder.fastFind("test link", true, true);
66 }
67 finder.highlight(true, "Bla");
68 }
69 finder.highlight(true, "content");
70 }
72 function cleanup() {
73 gBrowser.removeTab(tab);
74 finish();
75 }