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;
5 MARIONETTE_HEAD_JS = 'head.js';
7 let number = "5555552368";
8 let outgoing;
10 function dial() {
11 log("Make an outgoing call.");
13 telephony.oncallschanged = function oncallschanged(event) {
14 log("Received 'callschanged' call event.");
16 if (!event.call) {
17 log("Notifying calls array is loaded. No call information accompanies.");
18 return;
19 }
21 let expected_states = ["dialing", "disconnected"];
22 ok(expected_states.indexOf(event.call.state) != -1,
23 "Unexpected call state: " + event.call.state);
25 if (event.call.state == "dialing") {
26 outgoing = event.call;
27 ok(outgoing);
28 is(outgoing.number, number);
30 is(outgoing, telephony.active);
31 is(telephony.calls.length, 1);
32 is(telephony.calls[0], outgoing);
34 checkCallList();
35 }
37 if (event.call.state == "disconnected") {
38 is(outgoing.state, "disconnected");
39 is(telephony.active, null);
40 is(telephony.calls.length, 0);
41 cleanUp();
42 }
43 };
45 telephony.dial(number);
46 }
48 function checkCallList() {
49 emulator.run("gsm list", function(result) {
50 log("Call list is now: " + result);
51 if ((result[0] == "outbound to " + number + " : unknown") && (result[1] == "OK")) {
52 answer();
53 } else {
54 window.setTimeout(checkCallList, 100);
55 }
56 });
57 }
59 function answer() {
60 log("Answering the outgoing call.");
62 // We get no "connecting" event when the remote party answers the call.
64 outgoing.onconnected = function onconnected(event) {
65 log("Received 'connected' call event.");
66 is(outgoing, event.call);
67 is(outgoing.state, "connected");
69 is(outgoing, telephony.active);
71 emulator.run("gsm list", function(result) {
72 log("Call list (after 'connected' event) is now: " + result);
73 is(result[0], "outbound to " + number + " : active");
74 is(result[1], "OK");
75 hangUp();
76 });
77 };
78 emulator.run("gsm accept " + number);
79 }
81 function hangUp() {
82 log("Hanging up the outgoing call.");
84 emulator.run("gsm cancel " + number);
85 }
87 function cleanUp() {
88 telephony.oncallschanged = null;
89 finish();
90 }
92 startTest(function() {
93 dial();
94 });