toolkit/components/thumbnails/test/browser_thumbnails_bg_no_duplicates.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 function runTests() {
     5   let url = "http://example.com/1";
     6   ok(!thumbnailExists(url), "Thumbnail file should not already exist.");
     7   let numCallbacks = 0;
     8   let doneCallback = function(doneUrl) {
     9     is(doneUrl, url, "called back with correct url");
    10     numCallbacks += 1;
    11     // We will delete the file after the first callback, then check it
    12     // still doesn't exist on the second callback, which should give us
    13     // confidence that we didn't end up with 2 different captures happening
    14     // for the same url...
    15     if (numCallbacks == 1) {
    16       ok(thumbnailExists(url), "Thumbnail file should now exist.");
    17       removeThumbnail(url);
    18       return;
    19     }
    20     if (numCallbacks == 2) {
    21       ok(!thumbnailExists(url), "Thumbnail file should still be deleted.");
    22       // and that's all we expect, so we are done...
    23       next();
    24       return;
    25     }
    26     ok(false, "only expecting 2 callbacks");
    27   }
    28   BackgroundPageThumbs.capture(url, {onDone: doneCallback});
    29   BackgroundPageThumbs.capture(url, {onDone: doneCallback});
    30   yield true;
    31 }

mercurial