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