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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 6 | |
michael@0 | 7 | function FooComponent() { |
michael@0 | 8 | this.wrappedJSObject = this; |
michael@0 | 9 | } |
michael@0 | 10 | FooComponent.prototype = |
michael@0 | 11 | { |
michael@0 | 12 | // nsIClassInfo + information for XPCOM registration code in XPCOMUtils.jsm |
michael@0 | 13 | classDescription: "Foo Component", |
michael@0 | 14 | classID: Components.ID("{6b933fe6-6eba-4622-ac86-e4f654f1b474}"), |
michael@0 | 15 | contractID: "@mozilla.org/tests/module-importer;1", |
michael@0 | 16 | |
michael@0 | 17 | // nsIClassInfo |
michael@0 | 18 | implementationLanguage: Components.interfaces.nsIProgrammingLanguage.JAVASCRIPT, |
michael@0 | 19 | flags: 0, |
michael@0 | 20 | |
michael@0 | 21 | getInterfaces: function getInterfaces(aCount) { |
michael@0 | 22 | var interfaces = [Components.interfaces.nsIClassInfo]; |
michael@0 | 23 | aCount.value = interfaces.length; |
michael@0 | 24 | |
michael@0 | 25 | // Guerilla test for line numbers hiding in this method |
michael@0 | 26 | var threw = true; |
michael@0 | 27 | try { |
michael@0 | 28 | thereIsNoSuchIdentifier; |
michael@0 | 29 | threw = false; |
michael@0 | 30 | } catch (ex) { |
michael@0 | 31 | do_check_true(ex.lineNumber == 28); |
michael@0 | 32 | } |
michael@0 | 33 | do_check_true(threw); |
michael@0 | 34 | |
michael@0 | 35 | return interfaces; |
michael@0 | 36 | }, |
michael@0 | 37 | |
michael@0 | 38 | getHelperForLanguage: function getHelperForLanguage(aLanguage) { |
michael@0 | 39 | return null; |
michael@0 | 40 | }, |
michael@0 | 41 | |
michael@0 | 42 | // nsISupports |
michael@0 | 43 | QueryInterface: function QueryInterface(aIID) { |
michael@0 | 44 | if (aIID.equals(Components.interfaces.nsIClassInfo) || |
michael@0 | 45 | aIID.equals(Components.interfaces.nsISupports)) |
michael@0 | 46 | return this; |
michael@0 | 47 | |
michael@0 | 48 | throw Components.results.NS_ERROR_NO_INTERFACE; |
michael@0 | 49 | } |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | function BarComponent() { |
michael@0 | 53 | } |
michael@0 | 54 | BarComponent.prototype = |
michael@0 | 55 | { |
michael@0 | 56 | // nsIClassInfo + information for XPCOM registration code in XPCOMUtils.jsm |
michael@0 | 57 | classDescription: "Module importer test 2", |
michael@0 | 58 | classID: Components.ID("{708a896a-b48d-4bff-906e-fc2fd134b296}"), |
michael@0 | 59 | contractID: "@mozilla.org/tests/module-importer;2", |
michael@0 | 60 | |
michael@0 | 61 | // nsIClassInfo |
michael@0 | 62 | implementationLanguage: Components.interfaces.nsIProgrammingLanguage.JAVASCRIPT, |
michael@0 | 63 | flags: 0, |
michael@0 | 64 | |
michael@0 | 65 | getInterfaces: function getInterfaces(aCount) { |
michael@0 | 66 | var interfaces = [Components.interfaces.nsIClassInfo]; |
michael@0 | 67 | aCount.value = interfaces.length; |
michael@0 | 68 | return interfaces; |
michael@0 | 69 | }, |
michael@0 | 70 | |
michael@0 | 71 | getHelperForLanguage: function getHelperForLanguage(aLanguage) { |
michael@0 | 72 | return null; |
michael@0 | 73 | }, |
michael@0 | 74 | |
michael@0 | 75 | // nsISupports |
michael@0 | 76 | QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIClassInfo]) |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | function do_check_true(cond, text) { |
michael@0 | 80 | // we don't have the test harness' utilities in this scope, so we need this |
michael@0 | 81 | // little helper. In the failure case, the exception is propagated to the |
michael@0 | 82 | // caller in the main run_test() function, and the test fails. |
michael@0 | 83 | if (!cond) |
michael@0 | 84 | throw "Failed check: " + text; |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | var gComponentsArray = [FooComponent, BarComponent]; |
michael@0 | 88 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory(gComponentsArray); |