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 const TEST_URL = "http://localhost";
6 setPref("b2g.update.apply-idle-timeout", 0);
7 setPref("app.update.backgroundErrors", 0);
8 setPref("app.update.backgroundMaxErrors", 100);
10 function forceCheckAndTestStatus(status, next) {
11 let mozSettings = window.navigator.mozSettings;
12 let forceSent = false;
14 mozSettings.addObserver("gecko.updateStatus", function statusObserver(setting) {
15 if (!forceSent) {
16 return;
17 }
19 mozSettings.removeObserver("gecko.updateStatus", statusObserver);
20 is(setting.settingValue, status, "gecko.updateStatus");
21 next();
22 });
24 sendContentEvent("force-update-check");
25 forceSent = true;
26 }
28 function testBadXml() {
29 setPref("app.update.url.override", TEST_URL + "/bad.xml");
30 forceCheckAndTestStatus("check-error-http-200", testAccessDenied);
31 }
33 function testAccessDenied() {
34 setPref("app.update.url.override", TEST_URL + "/cgi-bin/err.cgi?403");
35 forceCheckAndTestStatus("check-error-http-403", testNoUpdateXml);
36 }
38 function testNoUpdateXml() {
39 setPref("app.update.url.override", TEST_URL + "/none.html");
40 forceCheckAndTestStatus("check-error-http-404", testInternalServerError);
41 }
43 function testInternalServerError() {
44 setPref("app.update.url.override", TEST_URL + "/cgi-bin/err.cgi?500");
45 forceCheckAndTestStatus("check-error-http-500", testBadHostStatus);
46 }
48 function testBadHostStatus() {
49 setPref("app.update.url.override", "http://bad-host-doesnt-exist-sorry.com");
50 forceCheckAndTestStatus("check-error-" + Cr.NS_ERROR_UNKNOWN_HOST, cleanUp);
51 }
53 // Update test functions
54 function preUpdate() {
55 testBadXml();
56 }