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.setBoolPref("dom.sms.enabled", true);
7 SpecialPowers.addPermission("sms", true, document);
9 let manager = window.navigator.mozMobileMessage;
10 ok(manager instanceof MozMobileMessageManager,
11 "manager is instance of " + manager.constructor);
13 // Note: 378 chars and below is fine, but 379 and above will cause the issue.
14 // Sending first message works, but second one we get emulator callback but
15 // the actual SMS is never received, so script will timeout waiting for the
16 // onreceived event. Also note that a single larger message (i.e. 1600
17 // characters) works; so it is not a compounded send limit.
18 let fromNumber = "5551110000";
19 let msgLength = 379;
20 let msgText = new Array(msgLength + 1).join('a');
22 let pendingEmulatorCmdCount = 0;
23 function sendSmsToEmulator(from, text) {
24 ++pendingEmulatorCmdCount;
26 let cmd = "sms send " + from + " " + text;
27 runEmulatorCmd(cmd, function(result) {
28 --pendingEmulatorCmdCount;
30 is(result[0], "OK", "Emulator response");
31 });
32 }
34 function firstIncomingSms() {
35 simulateIncomingSms(secondIncomingSms);
36 }
38 function secondIncomingSms() {
39 simulateIncomingSms(cleanUp);
40 }
42 function simulateIncomingSms(nextFunction) {
43 log("Simulating incoming multipart SMS (" + msgText.length
44 + " chars total).");
46 manager.onreceived = function onreceived(event) {
47 log("Received 'onreceived' event.");
48 manager.onreceived = null;
50 let incomingSms = event.message;
51 ok(incomingSms, "incoming sms");
52 is(incomingSms.body, msgText, "msg body");
54 window.setTimeout(nextFunction, 0);
55 };
57 sendSmsToEmulator(fromNumber, msgText);
58 }
60 function cleanUp() {
61 if (pendingEmulatorCmdCount) {
62 window.setTimeout(cleanUp, 100);
63 return;
64 }
66 SpecialPowers.removePermission("sms", document);
67 SpecialPowers.clearUserPref("dom.sms.enabled");
68 finish();
69 }
71 // Start the test
72 firstIncomingSms();