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/
3 */
5 // Test the cancellable doing/done/cancelAll API in XPIProvider
7 let scope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
8 let XPIProvider = scope.XPIProvider;
10 function run_test() {
11 // Check that cancelling with nothing in progress doesn't blow up
12 XPIProvider.cancelAll();
14 // Check that a basic object gets cancelled
15 let getsCancelled = {
16 isCancelled: false,
17 cancel: function () {
18 if (this.isCancelled)
19 do_throw("Already cancelled");
20 this.isCancelled = true;
21 }
22 };
23 XPIProvider.doing(getsCancelled);
24 XPIProvider.cancelAll();
25 do_check_true(getsCancelled.isCancelled);
27 // Check that if we complete a cancellable, it doesn't get cancelled
28 let doesntGetCancelled = {
29 cancel: () => do_throw("This should not have been cancelled")
30 };
31 XPIProvider.doing(doesntGetCancelled);
32 do_check_true(XPIProvider.done(doesntGetCancelled));
33 XPIProvider.cancelAll();
35 // A cancellable that adds a cancellable
36 getsCancelled.isCancelled = false;
37 let addsAnother = {
38 isCancelled: false,
39 cancel: function () {
40 if (this.isCancelled)
41 do_throw("Already cancelled");
42 this.isCancelled = true;
43 XPIProvider.doing(getsCancelled);
44 }
45 }
46 XPIProvider.doing(addsAnother);
47 XPIProvider.cancelAll();
48 do_check_true(addsAnother.isCancelled);
49 do_check_true(getsCancelled.isCancelled);
51 // A cancellable that removes another. This assumes that Set() iterates in the
52 // order that members were added
53 let removesAnother = {
54 isCancelled: false,
55 cancel: function () {
56 if (this.isCancelled)
57 do_throw("Already cancelled");
58 this.isCancelled = true;
59 XPIProvider.done(doesntGetCancelled);
60 }
61 }
62 XPIProvider.doing(removesAnother);
63 XPIProvider.doing(doesntGetCancelled);
64 XPIProvider.cancelAll();
65 do_check_true(removesAnother.isCancelled);
66 }