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