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 | const Ci = Components.interfaces; |
michael@0 | 6 | |
michael@0 | 7 | function run_test() { |
michael@0 | 8 | // throw if anything goes wrong |
michael@0 | 9 | let testContent = "<a id=\"a\"><b id=\"b\">hey!<\/b><\/a>"; |
michael@0 | 10 | // should be able to construct a file |
michael@0 | 11 | var f1 = Blob([testContent], {"type" : "text/xml"}); |
michael@0 | 12 | // with either constructor syntax |
michael@0 | 13 | var f2 = new Blob([testContent], {"type" : "text/xml"}); |
michael@0 | 14 | |
michael@0 | 15 | // do some tests |
michael@0 | 16 | do_check_true(f1 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob"); |
michael@0 | 17 | do_check_true(f2 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob"); |
michael@0 | 18 | |
michael@0 | 19 | do_check_true(!(f1 instanceof Ci.nsIDOMFile), "Should not be a DOM File"); |
michael@0 | 20 | do_check_true(!(f2 instanceof Ci.nsIDOMFile), "Should not be a DOM File"); |
michael@0 | 21 | |
michael@0 | 22 | do_check_true(f1.type == "text/xml", "Wrong type"); |
michael@0 | 23 | do_check_true(f2.type == "text/xml", "Wrong type"); |
michael@0 | 24 | |
michael@0 | 25 | do_check_true(f1.size == testContent.length, "Wrong content size"); |
michael@0 | 26 | do_check_true(f2.size == testContent.length, "Wrong content size"); |
michael@0 | 27 | |
michael@0 | 28 | var f3 = new Blob(); |
michael@0 | 29 | do_check_true(f3.size == 0, "Wrong size"); |
michael@0 | 30 | do_check_true(f3.type == "", "Wrong type"); |
michael@0 | 31 | |
michael@0 | 32 | var threw = false; |
michael@0 | 33 | try { |
michael@0 | 34 | // Needs a valid ctor argument |
michael@0 | 35 | var f3 = Blob(Date(132131532)); |
michael@0 | 36 | } catch (e) { |
michael@0 | 37 | threw = true; |
michael@0 | 38 | } |
michael@0 | 39 | do_check_true(threw, "Passing a random object should fail"); |
michael@0 | 40 | } |