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.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 function runTests() {
5 // Visit the test page in the browser and tell it to set a cookie.
6 let url = bgTestPageURL({ setGreenCookie: true });
7 let tab = gBrowser.loadOneTab(url, { inBackground: false });
8 let browser = tab.linkedBrowser;
9 yield whenLoaded(browser);
11 // The root element of the page shouldn't be green yet.
12 let greenStr = "rgb(0, 255, 0)";
13 isnot(browser.contentDocument.documentElement.style.backgroundColor,
14 greenStr,
15 "The page shouldn't be green yet.");
17 // Cookie should be set now. Reload the page to verify. Its root element
18 // will be green if the cookie's set.
19 browser.reload();
20 yield whenLoaded(browser);
21 is(browser.contentDocument.documentElement.style.backgroundColor,
22 greenStr,
23 "The page should be green now.");
25 // Capture the page. Get the image data of the capture and verify it's not
26 // green. (Checking only the first pixel suffices.)
27 yield bgCapture(url);
28 ok(thumbnailExists(url), "Thumbnail file should exist after capture.");
30 retrieveImageDataForURL(url, function ([r, g, b]) {
31 isnot([r, g, b].toString(), [0, 255, 0].toString(),
32 "The captured page should not be green.");
33 gBrowser.removeTab(tab);
34 removeThumbnail(url);
35 next();
36 });
37 yield true;
38 }