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 | function test_BrokenFile(path, shouldThrow, expectedName) { |
michael@0 | 6 | var didThrow = false; |
michael@0 | 7 | try { |
michael@0 | 8 | Components.utils.import(path); |
michael@0 | 9 | } catch (ex) { |
michael@0 | 10 | var exceptionName = ex.name; |
michael@0 | 11 | print("ex: " + ex + "; name = " + ex.name); |
michael@0 | 12 | didThrow = true; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | do_check_eq(didThrow, shouldThrow); |
michael@0 | 16 | if (didThrow) |
michael@0 | 17 | do_check_eq(exceptionName, expectedName); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function run_test() { |
michael@0 | 21 | test_BrokenFile("resource://test/bogus_exports_type.jsm", true, "Error"); |
michael@0 | 22 | |
michael@0 | 23 | test_BrokenFile("resource://test/bogus_element_type.jsm", true, "Error"); |
michael@0 | 24 | |
michael@0 | 25 | test_BrokenFile("resource://test/non_existing.jsm", |
michael@0 | 26 | true, |
michael@0 | 27 | "NS_ERROR_FILE_NOT_FOUND"); |
michael@0 | 28 | |
michael@0 | 29 | test_BrokenFile("chrome://test/content/test.jsm", |
michael@0 | 30 | true, |
michael@0 | 31 | "NS_ERROR_ILLEGAL_VALUE"); |
michael@0 | 32 | |
michael@0 | 33 | // check that we can access modules' global objects even if |
michael@0 | 34 | // EXPORTED_SYMBOLS is missing or ill-formed: |
michael@0 | 35 | do_check_eq(typeof(Components.utils.import("resource://test/bogus_exports_type.jsm", |
michael@0 | 36 | null)), |
michael@0 | 37 | "object"); |
michael@0 | 38 | |
michael@0 | 39 | do_check_eq(typeof(Components.utils.import("resource://test/bogus_element_type.jsm", |
michael@0 | 40 | null)), |
michael@0 | 41 | "object"); |
michael@0 | 42 | } |