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 MARIONETTE_TIMEOUT = 60000;
6 SpecialPowers.addPermission("mobileconnection", true, document);
8 let connection = navigator.mozMobileConnections[0];
9 ok(connection instanceof MozMobileConnection,
10 "connection is instanceof " + connection.constructor);
12 function failedToSetRoamingPreference(mode, expectedErrorMessage, callback) {
13 let request = connection.setRoamingPreference(mode);
15 ok(request instanceof DOMRequest,
16 "request instanceof " + request.constructor);
18 request.onsuccess = function onsuccess() {
19 ok(false, "Should not be here !!");
21 callback();
22 }
24 request.onerror = function onerror() {
25 is(request.error.name, expectedErrorMessage);
27 callback();
28 }
29 }
31 function testSetRoamingPreferenceWithNullValue() {
32 log("test setRoamingPreference(null)");
34 failedToSetRoamingPreference(null, "InvalidParameter", runNextTest);
35 }
37 function testSetRoamingPreferenceWithInvalidValue() {
38 log("test setRoamingPreference(\"InvalidValue\")");
40 failedToSetRoamingPreference("InvalidValue", "InvalidParameter", runNextTest);
41 }
43 function testSetRoamingPreferenceToHome() {
44 log("test setRoamingPreference(\"home\")");
46 // TODO: Bug 896394.
47 // Currently emulator run as GSM mode by default. So we expect to get a
48 // 'RequestNotSupported' error here.
49 failedToSetRoamingPreference("home", "RequestNotSupported", runNextTest);
50 }
52 function testGetRoamingPreference() {
53 log("test getRoamingPreference()");
55 // TODO: Bug 896394.
56 // Currently emulator run as GSM mode by default. So we expect to get a
57 // 'RequestNotSupported' error here.
58 let request = connection.getRoamingPreference();
60 ok(request instanceof DOMRequest,
61 "request instanceof " + request.constructor);
63 request.onsuccess = function onsuccess() {
64 ok(false, "Should not be here !!");
66 runNextTest();
67 }
69 request.onerror = function onerror() {
70 is(request.error.name, "RequestNotSupported");
72 runNextTest();
73 }
74 }
76 let tests = [
77 testSetRoamingPreferenceWithNullValue,
78 testSetRoamingPreferenceWithInvalidValue,
79 testSetRoamingPreferenceToHome,
80 testGetRoamingPreference
81 ];
83 function runNextTest() {
84 let test = tests.shift();
85 if (!test) {
86 cleanUp();
87 return;
88 }
90 test();
91 }
93 function cleanUp() {
94 SpecialPowers.removePermission("mobileconnection", document);
95 finish();
96 }
98 runNextTest();