Bug 669541: Fix extensions.checkCompatibility.nightly to not disable compatibility in aurora builds. r=robstrong
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 15 Aug 2011 15:42:32 -0700
changeset 75338 7f2895987cb7126473f1cf65154a0226b4bd479d
parent 75337 36a5644e9d6fff8849c74616165bad2febf6a514
child 75339 01ce7e95d7b7dff50e519345295ffa383e595e67
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersrobstrong
bugs669541
milestone8.0a1
Bug 669541: Fix extensions.checkCompatibility.nightly to not disable compatibility in aurora builds. r=robstrong
toolkit/mozapps/extensions/Makefile.in
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
--- a/toolkit/mozapps/extensions/Makefile.in
+++ b/toolkit/mozapps/extensions/Makefile.in
@@ -34,22 +34,22 @@
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
+include $(DEPTH)/config/autoconf.mk
+
 ifeq (,$(filter aurora beta release,$(MOZ_UPDATE_CHANNEL)))
-DEFINES += -DMOZ_COMPATABILITY_NIGHTLY=1
+DEFINES += -DMOZ_COMPATIBILITY_NIGHTLY=1
 endif
 
-include $(DEPTH)/config/autoconf.mk
-
 MODULE = extensions
 
 XPIDLSRCS = \
   amIInstallTrigger.idl \
   amIWebInstallListener.idl \
   amIWebInstaller.idl \
   $(NULL)
 
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -120,17 +120,17 @@ const PREFIX_NS_EM                    = 
 
 const TOOLKIT_ID                      = "toolkit@mozilla.org";
 
 const BRANCH_REGEXP                   = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
 
 const DB_SCHEMA                       = 5;
 const REQ_VERSION                     = 2;
 
-#ifdef MOZ_COMPATABILITY_NIGHTLY
+#ifdef MOZ_COMPATIBILITY_NIGHTLY
 const PREF_EM_CHECK_COMPATIBILITY = PREF_EM_CHECK_COMPATIBILITY_BASE +
                                     ".nightly";
 #else
 const PREF_EM_CHECK_COMPATIBILITY = PREF_EM_CHECK_COMPATIBILITY_BASE + "." +
                                     Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
 #endif
 
 // Properties that exist in the install manifest
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -57,17 +57,17 @@ const PREF_CHECK_UPDATE_SECURITY = "exte
 const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
 const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled";
 const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden";
 const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory";
 
 const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
 
-#ifdef MOZ_COMPATABILITY_NIGHTLY
+#ifdef MOZ_COMPATIBILITY_NIGHTLY
 const PREF_CHECK_COMPATIBILITY = PREF_CHECK_COMPATIBILITY_BASE +
                                  ".nightly";
 #else
 const PREF_CHECK_COMPATIBILITY = PREF_CHECK_COMPATIBILITY_BASE + "." +
                                  Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
 #endif
 
 const LOADING_MSG_DELAY = 100;
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -363,16 +363,22 @@ function shutdownManager() {
             getService(AM_Ci.nsIThreadManager).
             mainThread;
 
   // Wait until we observe the shutdown notifications
   while (!repositoryShutdown || !xpiShutdown) {
     if (thr.hasPendingEvents())
       thr.processNextEvent(false);
   }
+
+  // Force the XPIProvider provider to reload since it defines some constants on
+  // load that need to change during tests
+  let scope = Components.utils.import("resource://gre/modules/XPIProvider.jsm");
+  AddonManagerPrivate.unregisterProvider(scope.XPIProvider);
+  Components.utils.unload("resource://gre/modules/XPIProvider.jsm");
 }
 
 function loadAddonsList() {
   function readDirectories(aSection) {
     var dirs = [];
     var keys = parser.getKeys(aSection);
     while (keys.hasMore()) {
       let descriptor = parser.getString(aSection, keys.getNext());
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js
@@ -1080,20 +1080,22 @@ function check_test_23() {
 
       let dir = do_get_addon_root_uri(profileDir, "bootstrap1@tests.mozilla.org");
       do_check_eq(b1.getResourceURI("bootstrap.js").spec, dir + "bootstrap.js");
 
       AddonManager.getAddonsWithOperationsByTypes(null, function(list) {
         do_check_eq(list.length, 0);
 
         restartManager();
-        b1.uninstall();
-        restartManager();
+        AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
+          b1.uninstall();
+          restartManager();
 
-        testserver.stop(run_test_24);
+          testserver.stop(run_test_24);
+        });
       });
     });
   });
 }
 
 // Tests that we recover from a broken preference
 function run_test_24() {
   resetPrefs();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
@@ -255,20 +255,22 @@ function run_test_1() {
     dbfile.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755);
 
     // Accessing the add-ons should open and recover the database
     AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                  "addon2@tests.mozilla.org",
                                  "addon3@tests.mozilla.org",
                                  "addon4@tests.mozilla.org",
                                  "addon5@tests.mozilla.org",
+                                 "addon6@tests.mozilla.org",
+                                 "addon7@tests.mozilla.org",
                                  "theme1@tests.mozilla.org",
                                  "theme2@tests.mozilla.org"], function([a1, a2, a3,
-                                                                        a4, a5, t1,
-                                                                        t2]) {
+                                                                        a4, a5, a6,
+                                                                        a7, t1, t2]) {
       // Should be correctly recovered
       do_check_neq(a1, null);
       do_check_true(a1.isActive);
       do_check_false(a1.userDisabled);
       do_check_false(a1.appDisabled);
       do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
 
       // Should be correctly recovered