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