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 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
6 const Ci = Components.interfaces;
7 const Cu = Components.utils;
9 Cu.import("resource://gre/modules/Services.jsm");
10 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
12 function testForExpectedSymbols(stage, data) {
13 const expectedSymbols = [ "IDBKeyRange", "indexedDB" ];
14 for each (var symbol in expectedSymbols) {
15 Services.prefs.setBoolPref("indexeddbtest.bootstrap." + stage + "." +
16 symbol, symbol in this);
17 }
18 }
20 function GlobalObjectsComponent() {
21 this.wrappedJSObject = this;
22 }
24 GlobalObjectsComponent.prototype =
25 {
26 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
28 runTest: function() {
29 const name = "Splendid Test";
31 let ok = this.ok;
32 let finishTest = this.finishTest;
34 let keyRange = IDBKeyRange.only(42);
35 ok(keyRange, "Got keyRange");
37 let request = indexedDB.open(name, 1);
38 request.onerror = function(event) {
39 ok(false, "indexedDB error, '" + event.target.error.name + "'");
40 finishTest();
41 }
42 request.onsuccess = function(event) {
43 let db = event.target.result;
44 ok(db, "Got database");
45 finishTest();
46 }
47 }
48 };
50 var gFactory = {
51 register: function() {
52 var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
54 var classID = Components.ID("{d6f85dcb-537d-447e-b783-75d4b405622d}");
55 var description = "IndexedDBTest";
56 var contractID = "@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1";
57 var factory = XPCOMUtils._getFactory(GlobalObjectsComponent);
59 registrar.registerFactory(classID, description, contractID, factory);
61 this.unregister = function() {
62 registrar.unregisterFactory(classID, factory);
63 delete this.unregister;
64 };
65 }
66 };
68 function install(data, reason) {
69 testForExpectedSymbols("install");
70 }
72 function startup(data, reason) {
73 testForExpectedSymbols("startup");
74 gFactory.register();
75 }
77 function shutdown(data, reason) {
78 testForExpectedSymbols("shutdown");
79 gFactory.unregister();
80 }
82 function uninstall(data, reason) {
83 testForExpectedSymbols("uninstall");
84 }