Backout bug 741972 / changeset 993d0e9edd3f due to test failures
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 17 Apr 2012 12:01:14 +0100
changeset 91853 9caaf32e08fc012fb993b4bed2296fbb9086a75a
parent 91852 bcc6fb80cd73b1016bac26505afcb2b62809d287
child 91854 913f7811c0681b7485a61044502a1877f3c96006
push id690
push usertim.taubert@gmx.de
push dateThu, 19 Apr 2012 08:49:11 +0000
treeherderfx-team@a9b543de6b67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs741972
milestone14.0a1
Backout bug 741972 / changeset 993d0e9edd3f due to test failures
toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js
toolkit/mozapps/extensions/test/browser/browser_searching.js
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js
toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js
toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js
toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js
toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js
toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js
toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js
toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js
toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
--- a/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js
@@ -11,18 +11,33 @@ function test() {
 
 function end_test() {
   finish();
 }
 
 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");
     is_element_visible(hbox, "Check Compatibility warning hbox should be visible");
     var button = aWindow.document.querySelector("#list-view button.global-warning-checkcompatibility");
     is_element_visible(button, "Check Compatibility warning button should be visible");
 
     info("Clicking 'Enable' button");
--- a/toolkit/mozapps/extensions/test/browser/browser_searching.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_searching.js
@@ -14,16 +14,32 @@ const REMOTE_TO_INSTALL = "remote1";
 const REMOTE_INSTALL_URL = TESTROOT + "addons/browser_searching.xpi";
 
 var gManagerWindow;
 var gCategoryUtilities;
 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
   Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
 
   waitForExplicitFinish();
 
@@ -587,26 +603,26 @@ add_test(function() {
       check_filtered_results(QUERY, "relevancescore", false);
       run_next_test();
     });
   });
 });
 
 // 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");
     is(item.getAttribute("notification"), "warning", "Compatibility warning should be shown");
 
     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();
   });
 });
 
 // Tests that compatible-by-default addons are shown if strict compatibility checking is disabled
 add_test(function() {
   restart_manager(gManagerWindow, null, function(aWindow) {
     gManagerWindow = aWindow;
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -21,20 +21,16 @@ Components.utils.import("resource://gre/
 Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
 var gInternalManager = null;
 var gAppInfo = null;
 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
     vendor: "Mozilla",
     name: name,
     ID: id,
     version: version,
     appBuildID: "2007010101",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js
@@ -10,16 +10,29 @@ const PREF_GETADDONS_GETSEARCHRESULTS   
 do_load_httpd_js();
 var gServer;
 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.
   gServer = new nsHttpServer();
   gServer.registerDirectory("/data/", do_get_file("data"));
   gServer.start(4444);
 
   Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS,
                              "http://localhost:4444/data/test_AddonRepository_compatmode_%COMPATIBILITY_MODE%.xml");
   startupManager();
@@ -66,17 +79,17 @@ function run_test_2() {
       do_throw("Search should not have failed");
     }
   });
 }
 
 // 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) {
       do_check_neq(aAddons, null);
       do_check_eq(aAddons.length, 1);
       do_check_eq(aAddons[0].id, "compatmode-ignore@tests.mozilla.org");
 
       end_test();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_2.js
@@ -33,18 +33,31 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL
  *
  * ***** END LICENSE BLOCK *****
  */
 
 // 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",
   "test_bug470377_2",
   "test_bug470377_3",
   "test_bug470377_4",
   "test_bug470377_5",
 ];
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js
@@ -97,18 +97,31 @@ function run_test_1() {
     do_check_neq(a5, null);
     do_check_true(a5.isActive);
 
     run_test_2();
   });
 }
 
 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",
                                "bug470377_2@tests.mozilla.org",
                                "bug470377_3@tests.mozilla.org",
                                "bug470377_4@tests.mozilla.org",
                                "bug470377_5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3_strictcompat.js
@@ -96,18 +96,31 @@ function run_test_1() {
     do_check_neq(a5, null);
     do_check_true(a5.isActive);
 
     run_test_2();
   });
 }
 
 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",
                                "bug470377_2@tests.mozilla.org",
                                "bug470377_3@tests.mozilla.org",
                                "bug470377_4@tests.mozilla.org",
                                "bug470377_5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_4.js
@@ -31,16 +31,31 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL
  *
  * ***** 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");
 
   // inject the add-ons into the profile
   var profileDir = gProfD.clone();
   profileDir.append("extensions");
   var dest = profileDir.clone();
@@ -68,18 +83,18 @@ function run_test() {
   dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
   source = do_get_file("data/test_bug470377/install_5.rdf");
   source.copyTo(dest, "install.rdf");
 
   run_test_1();
 }
 
 function run_test_1() {
-  AddonManager.checkCompatibility = false;
-
+  // Disable compatibility checks
+  Services.prefs.setBoolPref(checkCompatPref, false);
   startupManager();
 
   AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
                                "bug470377_2@tests.mozilla.org",
                                "bug470377_3@tests.mozilla.org",
                                "bug470377_4@tests.mozilla.org",
                                "bug470377_5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
@@ -94,18 +109,18 @@ function run_test_1() {
     do_check_neq(a5, null);
     do_check_true(a5.isActive);
 
     run_test_2();
   });
 }
 
 function run_test_2() {
-  AddonManager.checkCompatibility = true;
-
+  // Enable compatibility checks
+  Services.prefs.setBoolPref(checkCompatPref, true);
   restartManager();
 
   AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
                                "bug470377_2@tests.mozilla.org",
                                "bug470377_3@tests.mozilla.org",
                                "bug470377_4@tests.mozilla.org",
                                "bug470377_5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug521905.js
@@ -36,28 +36,31 @@
  * ***** END LICENSE BLOCK *****
  */
 
 const ADDON = "test_bug521905";
 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";
   try {
     channel = Services.prefs.getCharPref("app.update.channel");
   }
   catch (e) { }
 
   // 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;
   }
 
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.0pre", "2");
 
   startupManager();
   installAllFiles([do_get_addon(ADDON)], function() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_checkcompatibility.js
@@ -54,24 +54,36 @@ var ADDONS = [{
     minVersion: "1",
     maxVersion: "3"
   }]
 }];
 
 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");
 
   ADDONS.forEach(function(a) {
     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();
 }
 
 /**
  * Checks that the add-ons are enabled as expected.
  * @param   overridden
@@ -128,18 +140,20 @@ function run_test_1() {
 
     run_test_2();
   });
 }
 
 // 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",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org",
                                "addon5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
@@ -147,24 +161,18 @@ function run_test_2() {
 
     run_test_3();
   });
 }
 
 // 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",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org",
                                "addon5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
@@ -172,18 +180,20 @@ function run_test_3() {
 
     run_test_4();
   });
 }
 
 // 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",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org",
                                "addon5@tests.mozilla.org"],
                                function([a1, a2, a3, a4, a5]) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_pref_properties.js
@@ -127,17 +127,19 @@ function run_test() {
   do_check_true(Services.prefs.getBoolPref("extensions.strictCompatibility"));
 
 
   // AddonManager.checkCompatibility
   var channel = "default";
   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");
   }
   const COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
 
   gManagerEventsListener.expect(["onCompatibilityModeChanged"]);
   AddonManager.checkCompatibility = false;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
@@ -9,20 +9,35 @@
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 
 do_load_httpd_js();
 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"));
   testserver.registerDirectory("/addons/", do_get_file("addons"));
   testserver.start(4444);
 
   writeInstallRDFForExtension({
     id: "compatmode-normal@tests.mozilla.org",
@@ -154,17 +169,17 @@ function run_test_3() {
       }
     }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
   });
 }
 
 // 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({
       onCompatibilityUpdateAvailable: function() {
         do_throw("Should have not have seen compatibility information");
       },
 
       onNoUpdateAvailable: function() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
@@ -1,22 +1,34 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // This verifies that AddonUpdateChecker works correctly
 
 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"));
   testserver.start(4444);
 
   do_test_pending();
   run_test_1();
 }