toolkit/components/thumbnails/test/browser_thumbnails_bug818225.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/" +
     5             "test/background_red.html?" + Date.now();
     7 // Test PageThumbs API function getThumbnailPath
     8 function runTests() {
    10   let path = PageThumbs.getThumbnailPath(URL);
    11   yield testIfExists(path, false, "Thumbnail file does not exist");
    13   yield addVisitsAndRepopulateNewTabLinks(URL, next);
    14   yield createThumbnail(URL);
    16   path = PageThumbs.getThumbnailPath(URL);
    17   let expectedPath = PageThumbsStorage.getFilePathForURL(URL);
    18   is(path, expectedPath, "Thumbnail file has correct path");
    20   yield testIfExists(path, true, "Thumbnail file exists");
    22 }
    24 function createThumbnail(aURL) {
    25   addTab(aURL, function () {
    26     whenFileExists(aURL, function () {
    27       gBrowser.removeTab(gBrowser.selectedTab);
    28       next();
    29     });
    30   });
    31 }
    33 function testIfExists(aPath, aExpected, aMessage) {
    34   return OS.File.exists(aPath).then(
    35     function onSuccess(exists) {
    36       is(exists, aExpected, aMessage);
    37     },
    38     function onFailure(error) {
    39       ok(false, "OS.File.exists() failed " + error);
    40     }
    41   );
    42 }

mercurial