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 | const PHONE_NUMBER = "+1234567890"; |
michael@0 | 8 | |
michael@0 | 9 | // Have a long long subject causes the send fails, so we don't need |
michael@0 | 10 | // networking here. |
michael@0 | 11 | const MMS_MAX_LENGTH_SUBJECT = 40; |
michael@0 | 12 | function genMmsSubject(sep) { |
michael@0 | 13 | return "Hello " + (new Array(MMS_MAX_LENGTH_SUBJECT).join(sep)) + " World!"; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | function testSms(aProgressStr, aText) { |
michael@0 | 17 | log("Testing thread subject: " + aProgressStr); |
michael@0 | 18 | |
michael@0 | 19 | return sendSmsWithSuccess(PHONE_NUMBER, aText) |
michael@0 | 20 | .then(function(message) { |
michael@0 | 21 | log(" SMS sent, retrieving thread of id " + message.threadId); |
michael@0 | 22 | return getThreadById(message.threadId); |
michael@0 | 23 | }) |
michael@0 | 24 | .then(function(thread) { |
michael@0 | 25 | log(" Got thread.lastMessageSubject = '" + thread.lastMessageSubject + "'"); |
michael@0 | 26 | is(thread.lastMessageSubject, "", "thread.lastMessageSubject"); |
michael@0 | 27 | }); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | function testMms(aProgressStr, aSubject) { |
michael@0 | 31 | log("Testing thread subject: " + aProgressStr); |
michael@0 | 32 | |
michael@0 | 33 | let mmsParameters = { |
michael@0 | 34 | receivers: [PHONE_NUMBER], |
michael@0 | 35 | subject: aSubject, |
michael@0 | 36 | attachments: [], |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | // We use a long long message subject so it will always fail. |
michael@0 | 40 | return sendMmsWithFailure(mmsParameters) |
michael@0 | 41 | .then(function(result) { |
michael@0 | 42 | log(" MMS sent, retrieving thread of id " + result.message.threadId); |
michael@0 | 43 | return getThreadById(result.message.threadId); |
michael@0 | 44 | }) |
michael@0 | 45 | .then(function(thread) { |
michael@0 | 46 | log(" Got thread.lastMessageSubject = '" + thread.lastMessageSubject + "'"); |
michael@0 | 47 | is(thread.lastMessageSubject, aSubject, "thread.lastMessageSubject"); |
michael@0 | 48 | }); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | startTestCommon(function testCaseMain() { |
michael@0 | 52 | return testSms("SMS", "text") |
michael@0 | 53 | .then(testMms.bind(null, "SMS..MMS", genMmsSubject(" "))) |
michael@0 | 54 | .then(testSms.bind(null, "SMS..MMS..SMS", "text")) |
michael@0 | 55 | .then(deleteAllMessages) |
michael@0 | 56 | .then(testMms.bind(null, "MMS", genMmsSubject(" "))) |
michael@0 | 57 | .then(testSms.bind(null, "MMS..SMS", "text")) |
michael@0 | 58 | .then(testMms.bind(null, "MMS..SMS..MMS", genMmsSubject(" "))) |
michael@0 | 59 | .then(deleteAllMessages) |
michael@0 | 60 | .then(testSms.bind(null, "SMS", "1")) |
michael@0 | 61 | .then(testSms.bind(null, "SMS..SMS", "2")) |
michael@0 | 62 | .then(testSms.bind(null, "SMS..SMS..SMS", "3")) |
michael@0 | 63 | .then(deleteAllMessages) |
michael@0 | 64 | .then(testMms.bind(null, "MMS", genMmsSubject("a"))) |
michael@0 | 65 | .then(testMms.bind(null, "MMS..MMS", genMmsSubject("b"))) |
michael@0 | 66 | .then(testMms.bind(null, "MMS..MMS..MMS", genMmsSubject("c"))); |
michael@0 | 67 | }); |