toolkit/components/places/tests/browser/browser_favicon_privatebrowsing_perwindowpb.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/. */
     5 function test() {
     6   waitForExplicitFinish();
     8   const pageURI =
     9    "http://example.org/tests/toolkit/components/places/tests/browser/favicon.html";
    10   let windowsToClose = [];
    12   registerCleanupFunction(function() {
    13     windowsToClose.forEach(function(aWin) {
    14       aWin.close();
    15     });
    16   });
    18   function testOnWindow(aIsPrivate, aCallback) {
    19     whenNewWindowLoaded({private: aIsPrivate}, function(aWin) {
    20       windowsToClose.push(aWin);
    21       executeSoon(function() aCallback(aWin));
    22     });
    23   };
    25   function waitForTabLoad(aWin, aCallback) {
    26     aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    27       aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    28       aCallback();
    29     }, true);
    30     aWin.gBrowser.selectedBrowser.loadURI(pageURI);
    31   }
    33   testOnWindow(true, function(win) {
    34     waitForTabLoad(win, function() {
    35       PlacesUtils.favicons.getFaviconURLForPage(NetUtil.newURI(pageURI),
    36         function(uri, dataLen, data, mimeType) {
    37           is(uri, null, "No result should be found");
    38           finish();
    39         }
    40       );
    41     });
    42   });
    43 }

mercurial