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.addPermission("sms", true, document);
8 // Expected SMSC addresses of emulator
9 const SMSC = "\"+123456789\",145";
11 let manager = window.navigator.mozMobileMessage;
13 let tasks = {
14 // List of test fuctions. Each of them should call |tasks.next()| when
15 // completed or |tasks.finish()| to jump to the last one.
16 _tasks: [],
17 _nextTaskIndex: 0,
19 push: function(func) {
20 this._tasks.push(func);
21 },
23 next: function() {
24 let index = this._nextTaskIndex++;
25 let task = this._tasks[index];
26 try {
27 task();
28 } catch (ex) {
29 ok(false, "test task[" + index + "] throws: " + ex);
30 // Run last task as clean up if possible.
31 if (index != this._tasks.length - 1) {
32 this.finish();
33 }
34 }
35 },
37 finish: function() {
38 this._tasks[this._tasks.length - 1]();
39 },
41 run: function() {
42 this.next();
43 }
44 };
46 tasks.push(function init() {
47 log("Initialize test object.");
48 ok(manager instanceof MozMobileMessageManager,
49 "manager is instance of " + manager.constructor);
50 tasks.next();
51 });
53 tasks.push(function readSmscAddress() {
54 log("read SMSC address");
56 let req = manager.getSmscAddress();
57 ok(req, "DOMRequest object for getting smsc address");
59 req.onsuccess = function(e) {
60 is(e.target.result, SMSC, "SMSC address");
61 tasks.next();
62 };
64 req.onerror = function(error) {
65 ok(false, "readSmscAddress(): Received 'onerror'");
66 tasks.finish();
67 };
68 });
70 // WARNING: All tasks should be pushed before this!!!
71 tasks.push(function cleanUp() {
72 manager.onreceived = null;
73 SpecialPowers.removePermission("sms", document);
74 finish();
75 });
77 // Start the test
78 tasks.run();