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