toolkit/devtools/server/tests/browser/head.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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/. */
     4 let tempScope = {};
     5 Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
     6 Cu.import("resource://gre/modules/devtools/Console.jsm", tempScope);
     7 const require = tempScope.devtools.require;
     8 const console = tempScope.console;
     9 tempScope = null;
    10 const PATH = "browser/toolkit/devtools/server/tests/browser/";
    11 const MAIN_DOMAIN = "http://test1.example.org/" + PATH;
    12 const ALT_DOMAIN = "http://sectest1.example.org/" + PATH;
    13 const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
    15 /**
    16  * Open a new tab at a URL and call a callback on load
    17  */
    18 function addTab(aURL, aCallback) {
    19   waitForExplicitFinish();
    21   gBrowser.selectedTab = gBrowser.addTab();
    22   content.location = aURL;
    24   let tab = gBrowser.selectedTab;
    25   let browser = gBrowser.getBrowserForTab(tab);
    27   function onTabLoad(event) {
    28     if (event.originalTarget.location.href != aURL) {
    29       return;
    30     }
    31     browser.removeEventListener("load", onTabLoad, true);
    32     aCallback(browser.contentDocument);
    33   }
    35   browser.addEventListener("load", onTabLoad, true);
    36 }
    38 /**
    39  * Forces GC, CC and Shrinking GC to get rid of disconnected docshells and
    40  * windows.
    41  */
    42 function forceCollections() {
    43   Cu.forceGC();
    44   Cu.forceCC();
    45   Cu.forceShrinkingGC();
    46 }
    48 registerCleanupFunction(function tearDown() {
    49   while (gBrowser.tabs.length > 1) {
    50     gBrowser.removeCurrentTab();
    51   }
    52 });

mercurial