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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | MARIONETTE_TIMEOUT = 60000; |
michael@0 | 5 | MARIONETTE_HEAD_JS = 'head.js'; |
michael@0 | 6 | |
michael@0 | 7 | let outgoingCall; |
michael@0 | 8 | let outNumber = "5555551111"; |
michael@0 | 9 | |
michael@0 | 10 | function dial() { |
michael@0 | 11 | log("Make an outgoing call."); |
michael@0 | 12 | |
michael@0 | 13 | telephony.dial(outNumber).then(call => { |
michael@0 | 14 | outgoingCall = call; |
michael@0 | 15 | ok(outgoingCall); |
michael@0 | 16 | is(outgoingCall.number, outNumber); |
michael@0 | 17 | is(outgoingCall.state, "dialing"); |
michael@0 | 18 | |
michael@0 | 19 | is(outgoingCall, telephony.active); |
michael@0 | 20 | is(telephony.calls.length, 1); |
michael@0 | 21 | is(telephony.calls[0], outgoingCall); |
michael@0 | 22 | |
michael@0 | 23 | outgoingCall.onalerting = function onalerting(event) { |
michael@0 | 24 | log("Received 'alerting' call event."); |
michael@0 | 25 | |
michael@0 | 26 | is(outgoingCall, event.call); |
michael@0 | 27 | is(outgoingCall.state, "alerting"); |
michael@0 | 28 | |
michael@0 | 29 | emulator.run("gsm list", function(result) { |
michael@0 | 30 | log("Call list is now: " + result); |
michael@0 | 31 | is(result[0], "outbound to " + outNumber + " : ringing"); |
michael@0 | 32 | is(result[1], "OK"); |
michael@0 | 33 | answer(); |
michael@0 | 34 | }); |
michael@0 | 35 | }; |
michael@0 | 36 | }); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function answer() { |
michael@0 | 40 | log("Answering the outgoing call."); |
michael@0 | 41 | |
michael@0 | 42 | // We get no "connecting" event when the remote party answers the call. |
michael@0 | 43 | |
michael@0 | 44 | outgoingCall.onconnected = function onconnected(event) { |
michael@0 | 45 | log("Received 'connected' call event."); |
michael@0 | 46 | is(outgoingCall, event.call); |
michael@0 | 47 | is(outgoingCall.state, "connected"); |
michael@0 | 48 | |
michael@0 | 49 | is(outgoingCall, telephony.active); |
michael@0 | 50 | |
michael@0 | 51 | emulator.run("gsm list", function(result) { |
michael@0 | 52 | log("Call list is now: " + result); |
michael@0 | 53 | is(result[0], "outbound to " + outNumber + " : active"); |
michael@0 | 54 | is(result[1], "OK"); |
michael@0 | 55 | hangUp(); |
michael@0 | 56 | }); |
michael@0 | 57 | }; |
michael@0 | 58 | emulator.run("gsm accept " + outNumber); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | function hangUp() { |
michael@0 | 62 | log("Hanging up the outgoing call (local hang-up)."); |
michael@0 | 63 | |
michael@0 | 64 | let gotDisconnecting = false; |
michael@0 | 65 | outgoingCall.ondisconnecting = function ondisconnectingOut(event) { |
michael@0 | 66 | log("Received 'disconnecting' call event."); |
michael@0 | 67 | is(outgoingCall, event.call); |
michael@0 | 68 | is(outgoingCall.state, "disconnecting"); |
michael@0 | 69 | gotDisconnecting = true; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | outgoingCall.ondisconnected = function ondisconnectedOut(event) { |
michael@0 | 73 | log("Received 'disconnected' call event."); |
michael@0 | 74 | is(outgoingCall, event.call); |
michael@0 | 75 | is(outgoingCall.state, "disconnected"); |
michael@0 | 76 | ok(gotDisconnecting); |
michael@0 | 77 | |
michael@0 | 78 | is(telephony.active, null); |
michael@0 | 79 | is(telephony.calls.length, 0); |
michael@0 | 80 | |
michael@0 | 81 | emulator.run("gsm list", function(result) { |
michael@0 | 82 | log("Call list is now: " + result); |
michael@0 | 83 | is(result[0], "OK"); |
michael@0 | 84 | cleanUp(); |
michael@0 | 85 | }); |
michael@0 | 86 | }; |
michael@0 | 87 | outgoingCall.hangUp(); |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | function cleanUp() { |
michael@0 | 91 | finish(); |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | startTest(function() { |
michael@0 | 95 | dial(); |
michael@0 | 96 | }); |