Bug 953156 - Stop unregistering add-on chrome manifests at app shutdown; r=Unfocused
☠☠ backed out by ae51b76a9c88 ☠ ☠
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 06 Jan 2014 23:31:35 +1300
changeset 162178 4b3b3f0c6440ce87603291e41e4c143fa8c5b3f0
parent 162177 98660dab432f8dd53971db9fc046b61b4e686fb5
child 162179 ae51b76a9c882609c66485c768cf64ca63be1f2c
push idunknown
push userunknown
push dateunknown
reviewersUnfocused
bugs953156
milestone29.0a1
Bug 953156 - Stop unregistering add-on chrome manifests at app shutdown; r=Unfocused
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -4286,17 +4286,17 @@ var XPIProvider = {
       try {
         this.bootstrapScopes[aId][aMethod](params, aReason);
       }
       catch (e) {
         WARN("Exception running bootstrap method " + aMethod + " on " + aId, e);
       }
     }
     finally {
-      if (aMethod == "shutdown") {
+      if (aMethod == "shutdown" && aReason != BOOTSTRAP_REASONS.APP_SHUTDOWN) {
         LOG("Removing manifest for " + aFile.path);
         Components.manager.removeBootstrappedManifestLocation(aFile);
       }
       this.setTelemetry(aId, aMethod + "_MS", new Date() - timeStart);
     }
   },
 
   /**
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js
@@ -0,0 +1,51 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+function run_test() {
+  do_test_pending();
+  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
+  startupManager();
+
+  prepare_test({ }, [
+    "onNewInstall"
+  ]);
+
+  AddonManager.getInstallForFile(do_get_addon("test_bug675371"), function(install) {
+    ensure_test_completed();
+
+    do_check_neq(install, null);
+
+    prepare_test({
+      "bug675371@tests.mozilla.org": [
+        ["onInstalling", false],
+        "onInstalled"
+      ]
+    }, [
+      "onInstallStarted",
+      "onInstallEnded"
+    ], callback_soon(check_test));
+    install.install();
+  });
+}
+
+function check_test() {
+  AddonManager.getAddonByID("bug675371@tests.mozilla.org", do_exception_wrap(function(addon) {
+    do_check_neq(addon, null);
+    do_check_true(addon.isActive);
+
+    // Tests that chrome.manifest is registered when the addon is installed.
+    var target = { active: false };
+    Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
+    do_check_true(target.active);
+
+    shutdownManager();
+
+    // Tests that chrome.manifest remains registered at app shutdown.
+    target.active = false;
+    Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
+    do_check_true(target.active);
+
+    do_execute_soon(do_test_finished);
+  }));
+}
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
@@ -135,16 +135,17 @@ fail-if = os == "android"
 [test_bug619730.js]
 [test_bug620837.js]
 [test_bug655254.js]
 [test_bug659772.js]
 [test_bug675371.js]
 [test_bug740612.js]
 [test_bug753900.js]
 [test_bug757663.js]
+[test_bug953156.js]
 [test_cacheflush.js]
 [test_checkcompatibility.js]
 [test_childprocess.js]
 [test_ChromeManifestParser.js]
 [test_compatoverrides.js]
 [test_corrupt.js]
 [test_corrupt_strictcompat.js]
 [test_corruptfile.js]