diff --git a/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js b/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js index 787303c8f7e7..0541f0c9afef 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js +++ b/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js @@ -16,8 +16,23 @@ function end_test() { add_test(function() { info("Testing compatibility checking warning"); - info("Setting checkCompatibility to false"); - AddonManager.checkCompatibility = false; + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } + catch (e) { } + if (channel != "aurora" && + channel != "beta" && + channel != "release") { + var version = "nightly"; + } + else { + version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); + } + + var pref = "extensions.checkCompatibility." + version; + info("Setting " + pref + " pref to false") + Services.prefs.setBoolPref(pref, false); open_manager("addons://list/extension", function(aWindow) { var hbox = aWindow.document.querySelector("#list-view hbox.global-warning-checkcompatibility"); diff --git a/toolkit/mozapps/extensions/test/browser/browser_searching.js b/toolkit/mozapps/extensions/test/browser/browser_searching.js index 8eac0d92742a..4d5218c7c994 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_searching.js +++ b/toolkit/mozapps/extensions/test/browser/browser_searching.js @@ -19,6 +19,22 @@ var gProvider; var gServer; var gAddonInstalled = false; +var channel = "default"; +try { + channel = Services.prefs.getCharPref("app.update.channel"); +} +catch (e) { } +if (channel != "aurora" && + channel != "beta" && + channel != "release") { + var version = "nightly"; +} +else { + version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); +} + +const COMPATIBILITY_PREF = "extensions.checkCompatibility." + version; + function test() { requestLongerTimeout(2); // Turn on searching for this test @@ -592,7 +608,7 @@ add_test(function() { // Tests that incompatible add-ons are shown with a warning if compatibility checking is disabled add_test(function() { - AddonManager.checkCompatiblity = false; + Services.prefs.setBoolPref(COMPATIBILITY_PREF, false); search("incompatible", false, function() { var item = get_addon_item("remote5"); is_element_visible(item, "Incompatible addon should be visible"); @@ -601,7 +617,7 @@ add_test(function() { var item = get_addon_item("remote6"); is(item, null, "Addon incompatible with the product should not be visible"); - AddonManager.checkCompatiblity = true; + Services.prefs.clearUserPref(COMPATIBILITY_PREF); run_next_test(); }); }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js index cad208a1bd39..d988358dad8f 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js +++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ -26,10 +26,6 @@ var gAddonsList; var TEST_UNPACKED = false; -function isNightlyChannel(channel) { - return channel != "aurora" && channel != "beta" && channel != "release" && channel != "esr"; -} - function createAppInfo(id, name, version, platformVersion) { gAppInfo = { // nsIXULAppInfo diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js index 7a922e1218d4..83f896800bc9 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js @@ -15,6 +15,19 @@ function run_test() { do_test_pending(); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } catch (e) { } + if (channel != "aurora" && + channel != "beta" && + channel != "release") { + var version = "nightly"; + } else { + version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); + } + COMPATIBILITY_PREF = "extensions.checkCompatibility." + version; + // Create and configure the HTTP server. gServer = new nsHttpServer(); gServer.registerDirectory("/data/", do_get_file("data")); @@ -71,7 +84,7 @@ function run_test_2() { // Compatibility checking disabled. function run_test_3() { do_print("Testing with all compatibility checking disabled"); - AddonManager.checkCompatibility = false; + Services.prefs.setBoolPref(COMPATIBILITY_PREF, false); AddonRepository.searchAddons("test", 6, { searchSucceeded: function(aAddons) { diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js index c23e024fa0c4..2cecdfe29b92 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js @@ -38,8 +38,21 @@ // Disables security checking our updates which haven't been signed Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); +// Disables compatibility checking +var channel = "default"; +try { + channel = Services.prefs.getCharPref("app.update.channel"); +} +catch (e) { } -AddonManager.checkCompatibility = false; +if (channel != "aurora" && + channel != "beta" && + channel != "release") { + Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false); +} +else { + Services.prefs.setBoolPref("extensions.checkCompatibility.2", false); +} var ADDONS = [ "test_bug470377_1", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js index 36b50cffc584..3e019db1be8c 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js @@ -102,8 +102,21 @@ function run_test_1() { } function run_test_2() { - AddonManager.checkCompatibility = false; + // Disable compatibility checks + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } + catch (e) { } + if (channel != "aurora" && + channel != "beta" && + channel != "release") { + Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false); + } + else { + Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false); + } restartManager(); AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js index dc0b44226349..f0e8f426606a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js @@ -101,8 +101,21 @@ function run_test_1() { } function run_test_2() { - AddonManager.checkCompatibility = false; + // Disable compatibility checks + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } + catch (e) { } + if (channel != "aurora" && + channel != "beta" && + channel != "release") { + Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false); + } + else { + Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false); + } restartManager(); AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js index d66d729738cb..3958ad681da5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js @@ -36,6 +36,21 @@ * ***** END LICENSE BLOCK ***** */ +var channel = "default"; +try { + channel = Services.prefs.getCharPref("app.update.channel"); +} +catch (e) { } + +if (channel != "aurora" && + channel != "beta" && + channel != "release") { + var checkCompatPref = "extensions.checkCompatibility.nightly"; +} +else { + checkCompatPref = "extensions.checkCompatibility.2.1a"; +} + function run_test() { do_test_pending(); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.1a4", "2"); @@ -73,8 +88,8 @@ function run_test() { } function run_test_1() { - AddonManager.checkCompatibility = false; - + // Disable compatibility checks + Services.prefs.setBoolPref(checkCompatPref, false); startupManager(); AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", @@ -99,8 +114,8 @@ function run_test_1() { } function run_test_2() { - AddonManager.checkCompatibility = true; - + // Enable compatibility checks + Services.prefs.setBoolPref(checkCompatPref, true); restartManager(); AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js index daa5b89a8670..1bbb1b403699 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js @@ -41,7 +41,8 @@ const ID = "bug521905@tests.mozilla.org"; // Disables security checking our updates which haven't been signed Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); -AddonManager.checkCompatibility = false; +// Disables compatibility checking +Services.prefs.setBoolPref("extensions.checkCompatibility.2.0pre", false); function run_test() { var channel = "default"; @@ -52,7 +53,9 @@ function run_test() { // This test is only relevant on builds where the version is included in the // checkCompatibility preference name - if (isNightlyChannel(channel)) { + if (channel != "aurora" && + channel != "beta" && + channel != "release") { return; } diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js b/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js index f30c45387212..a49cafc7bd26 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js @@ -59,6 +59,8 @@ var ADDONS = [{ const profileDir = gProfD.clone(); profileDir.append("extensions"); +var gIsNightly = false; + function run_test() { do_test_pending(); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2"); @@ -67,6 +69,16 @@ function run_test() { writeInstallRDFForExtension(a, profileDir); }); + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } + catch (e) { } + + gIsNightly = channel != "aurora" && + channel != "beta" && + channel != "release"; + startupManager(); run_test_1(); @@ -133,8 +145,10 @@ function run_test_1() { // Tests that with compatibility checking disabled we see the incompatible // add-ons enabled function run_test_2() { - AddonManager.checkCompatibility = false; - + if (gIsNightly) + Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false); + else + Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false); restartManager(); AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", @@ -152,14 +166,8 @@ function run_test_2() { // Tests that with compatibility checking disabled we see the incompatible // add-ons enabled. function run_test_3() { - var channel = "default"; - try { - channel = Services.prefs.getCharPref("app.update.channel"); - } - catch (e) { } - - if (!isNightlyChannel(channel)) - AddonManager.checkCompatibility = false; + if (!gIsNightly) + Services.prefs.setBoolPref("extensions.checkCompatibility.2.1a", false); restartManager("2.1a4"); AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", @@ -177,8 +185,10 @@ function run_test_3() { // Tests that with compatibility checking enabled we see the incompatible // add-ons disabled. function run_test_4() { - AddonManager.checkCompatibility = true; - + if (gIsNightly) + Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", true); + else + Services.prefs.setBoolPref("extensions.checkCompatibility.2.1a", true); restartManager(); AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js b/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js index 6ec1c376f864..7914029b7464 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js @@ -132,7 +132,9 @@ function run_test() { try { channel = Services.prefs.getCharPref("app.update.channel"); } catch (e) { } - if (isNightlyChannel(channel)) { + if (channel != "aurora" && + channel != "beta" && + channel != "release") { var version = "nightly"; } else { version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js index 20ddc715ddc2..b4024e192646 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js @@ -14,10 +14,25 @@ var testserver; const profileDir = gProfD.clone(); profileDir.append("extensions"); +var COMPATIBILITY_PREF; + function run_test() { do_test_pending(); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } catch (e) { } + if (channel != "aurora" && + channel != "beta" && + channel != "release") { + var version = "nightly"; + } else { + version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); + } + COMPATIBILITY_PREF = "extensions.checkCompatibility." + version; + // Create and configure the HTTP server. testserver = new nsHttpServer(); testserver.registerDirectory("/data/", do_get_file("data")); @@ -159,7 +174,7 @@ function run_test_3() { // Compatibility checking disabled. function run_test_4() { do_print("Testing with all compatibility checking disabled"); - AddonManager.checkCompatibility = false; + Services.prefs.setBoolPref(COMPATIBILITY_PREF, false); AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org", function(addon) { do_check_neq(addon, null); addon.findUpdates({ diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js index 8581bcd530d2..f3b9b34b1ab9 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js @@ -6,12 +6,24 @@ Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm"); +var COMPATIBILITY_PREF; + do_load_httpd_js(); var testserver; function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + var channel = "default"; + try { + channel = Services.prefs.getCharPref("app.update.channel"); + } catch (e) { } + if (channel != "aurora" && channel != "beta" && channel != "release") + var version = "nightly"; + else + version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1"); + COMPATIBILITY_PREF = "extensions.checkCompatibility." + version; + // Create and configure the HTTP server. testserver = new nsHttpServer(); testserver.registerDirectory("/data/", do_get_file("data"));