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 'use strict';
3 // resolve multiple promise in parallel
4 function expectAll(aValue) {
5 let deferred = new Promise(function(resolve, reject) {
6 let countdown = aValue.length;
7 let resolutionValues = new Array(countdown);
9 for (let i = 0; i < aValue.length; i++) {
10 let index = i;
11 aValue[i].then(function(val) {
12 resolutionValues[index] = val;
13 if (--countdown === 0) {
14 resolve(resolutionValues);
15 }
16 }, reject);
17 }
18 });
20 return deferred;
21 }
23 function TestInit() {
24 let url = SimpleTest.getTestFileURL("RecordingStatusChromeScript.js")
25 let script = SpecialPowers.loadChromeScript(url);
27 let helper = {
28 finish: function () {
29 script.destroy();
30 },
31 fakeShutdown: function () {
32 script.sendAsyncMessage('fake-content-shutdown', {});
33 }
34 };
36 script.addMessageListener('chrome-event', function (message) {
37 if (helper.hasOwnProperty('onEvent')) {
38 helper.onEvent(message);
39 } else {
40 ok(false, 'unexpected message: ' + JSON.stringify(message));
41 }
42 });
44 script.sendAsyncMessage("init-chrome-event", {
45 type: 'recording-status'
46 });
48 return Promise.resolve(helper);
49 }
51 function expectEvent(expected, eventHelper) {
52 return new Promise(function(resolve, reject) {
53 eventHelper.onEvent = function(message) {
54 delete eventHelper.onEvent;
55 ok(message, JSON.stringify(message));
56 is(message.type, 'recording-status', 'event type: ' + message.type);
57 is(message.active, expected.active, 'recording active: ' + message.active);
58 is(message.isAudio, expected.isAudio, 'audio recording active: ' + message.isAudio);
59 is(message.isVideo, expected.isVideo, 'video recording active: ' + message.isVideo);
60 resolve(eventHelper);
61 };
62 info('waiting for recording-status');
63 });
64 }
66 function expectStream(params, callback) {
67 return new Promise(function(resolve, reject) {
68 var req = navigator.mozGetUserMedia(
69 params,
70 function(stream) {
71 ok(true, 'create media stream');
72 callback(stream);
73 resolve();
74 },
75 function(err) {
76 ok(false, 'fail to create media stream');
77 reject(err);
78 }
79 );
80 info('waiting for gUM result');
81 });
82 }