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 = 30000;
6 SpecialPowers.addPermission("mobileconnection", true, document);
8 // Permission changes can't change existing Navigator.prototype
9 // objects, so grab our objects from a new Navigator
10 let ifr = document.createElement("iframe");
11 let connection;
12 ifr.onload = function() {
13 connection = ifr.contentWindow.navigator.mozMobileConnections[0];
14 ok(connection instanceof ifr.contentWindow.MozMobileConnection,
15 "connection is instanceof " + connection.constructor);
17 // The emulator's hard coded iccid value.
18 // See it here {B2G_HOME}/external/qemu/telephony/sim_card.c.
19 is(connection.iccId, 89014103211118510720);
21 runNextTest();
22 };
23 document.body.appendChild(ifr);
25 function waitForIccChange(callback) {
26 connection.addEventListener("iccchange", function handler() {
27 connection.removeEventListener("iccchange", handler);
28 callback();
29 });
30 }
32 function setRadioEnabled(enabled) {
33 let request = connection.setRadioEnabled(enabled);
35 request.onsuccess = function onsuccess() {
36 log('setRadioEnabled: ' + enabled);
37 };
39 request.onerror = function onerror() {
40 ok(false, "setRadioEnabled should be ok");
41 };
42 }
44 function testIccChangeOnRadioPowerOff() {
45 // Turn off radio
46 setRadioEnabled(false);
48 waitForIccChange(function() {
49 is(connection.iccId, null);
50 runNextTest();
51 });
52 }
54 function testIccChangeOnRadioPowerOn() {
55 // Turn on radio
56 setRadioEnabled(true);
58 waitForIccChange(function() {
59 // The emulator's hard coded iccid value.
60 is(connection.iccId, 89014103211118510720);
61 runNextTest();
62 });
63 }
65 let tests = [
66 testIccChangeOnRadioPowerOff,
67 testIccChangeOnRadioPowerOn
68 ];
70 function runNextTest() {
71 let test = tests.shift();
72 if (!test) {
73 cleanUp();
74 return;
75 }
77 test();
78 }
80 function cleanUp() {
81 SpecialPowers.removePermission("mobileconnection", document);
83 finish();
84 }