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 | |
michael@0 | 6 | function run_test() { |
michael@0 | 7 | do_test_pending(); |
michael@0 | 8 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.1a4", "2"); |
michael@0 | 9 | |
michael@0 | 10 | // inject the add-ons into the profile |
michael@0 | 11 | var profileDir = gProfD.clone(); |
michael@0 | 12 | profileDir.append("extensions"); |
michael@0 | 13 | var dest = profileDir.clone(); |
michael@0 | 14 | dest.append("bug470377_1@tests.mozilla.org"); |
michael@0 | 15 | dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); |
michael@0 | 16 | var source = do_get_file("data/test_bug470377/install_1.rdf"); |
michael@0 | 17 | source.copyTo(dest, "install.rdf"); |
michael@0 | 18 | dest = profileDir.clone(); |
michael@0 | 19 | dest.append("bug470377_2@tests.mozilla.org"); |
michael@0 | 20 | dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); |
michael@0 | 21 | source = do_get_file("data/test_bug470377/install_2.rdf"); |
michael@0 | 22 | source.copyTo(dest, "install.rdf"); |
michael@0 | 23 | dest = profileDir.clone(); |
michael@0 | 24 | dest.append("bug470377_3@tests.mozilla.org"); |
michael@0 | 25 | dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); |
michael@0 | 26 | source = do_get_file("data/test_bug470377/install_3.rdf"); |
michael@0 | 27 | source.copyTo(dest, "install.rdf"); |
michael@0 | 28 | dest = profileDir.clone(); |
michael@0 | 29 | dest.append("bug470377_4@tests.mozilla.org"); |
michael@0 | 30 | dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); |
michael@0 | 31 | source = do_get_file("data/test_bug470377/install_4.rdf"); |
michael@0 | 32 | source.copyTo(dest, "install.rdf"); |
michael@0 | 33 | dest = profileDir.clone(); |
michael@0 | 34 | dest.append("bug470377_5@tests.mozilla.org"); |
michael@0 | 35 | dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); |
michael@0 | 36 | source = do_get_file("data/test_bug470377/install_5.rdf"); |
michael@0 | 37 | source.copyTo(dest, "install.rdf"); |
michael@0 | 38 | |
michael@0 | 39 | run_test_1(); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | function run_test_1() { |
michael@0 | 43 | startupManager(); |
michael@0 | 44 | AddonManager.checkCompatibility = false; |
michael@0 | 45 | restartManager(); |
michael@0 | 46 | |
michael@0 | 47 | AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", |
michael@0 | 48 | "bug470377_2@tests.mozilla.org", |
michael@0 | 49 | "bug470377_3@tests.mozilla.org", |
michael@0 | 50 | "bug470377_4@tests.mozilla.org", |
michael@0 | 51 | "bug470377_5@tests.mozilla.org"], |
michael@0 | 52 | function([a1, a2, a3, a4, a5]) { |
michael@0 | 53 | do_check_neq(a1, null); |
michael@0 | 54 | do_check_false(a1.isActive); |
michael@0 | 55 | do_check_neq(a2, null); |
michael@0 | 56 | do_check_true(a2.isActive); |
michael@0 | 57 | do_check_neq(a3, null); |
michael@0 | 58 | do_check_true(a3.isActive); |
michael@0 | 59 | do_check_neq(a4, null); |
michael@0 | 60 | do_check_true(a4.isActive); |
michael@0 | 61 | do_check_neq(a5, null); |
michael@0 | 62 | do_check_true(a5.isActive); |
michael@0 | 63 | |
michael@0 | 64 | do_execute_soon(run_test_2); |
michael@0 | 65 | }); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | function run_test_2() { |
michael@0 | 69 | AddonManager.checkCompatibility = true; |
michael@0 | 70 | |
michael@0 | 71 | restartManager(); |
michael@0 | 72 | |
michael@0 | 73 | AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", |
michael@0 | 74 | "bug470377_2@tests.mozilla.org", |
michael@0 | 75 | "bug470377_3@tests.mozilla.org", |
michael@0 | 76 | "bug470377_4@tests.mozilla.org", |
michael@0 | 77 | "bug470377_5@tests.mozilla.org"], |
michael@0 | 78 | function([a1, a2, a3, a4, a5]) { |
michael@0 | 79 | do_check_neq(a1, null); |
michael@0 | 80 | do_check_false(a1.isActive); |
michael@0 | 81 | do_check_neq(a2, null); |
michael@0 | 82 | do_check_false(a2.isActive); |
michael@0 | 83 | do_check_neq(a3, null); |
michael@0 | 84 | do_check_false(a3.isActive); |
michael@0 | 85 | do_check_neq(a4, null); |
michael@0 | 86 | do_check_true(a4.isActive); |
michael@0 | 87 | do_check_neq(a5, null); |
michael@0 | 88 | do_check_true(a5.isActive); |
michael@0 | 89 | |
michael@0 | 90 | do_execute_soon(do_test_finished); |
michael@0 | 91 | }); |
michael@0 | 92 | } |