Bug 1287007 - Fix test_ext_management_uninstall_self.js r=bsilverberg
authorRob Wu <rob@robwu.nl>
Tue, 13 Sep 2016 13:59:37 -0700
changeset 319132 b07b3ad62e31cad6ece15192d2d61965c0ac186d
parent 319131 851e08a1f368c42fcbe0f1522f22e36690dba0ae
child 319133 919c8b9e2ab4ef7aa51f7cf91c6c738a77e592e2
push id30861
push usercbook@mozilla.com
push dateMon, 24 Oct 2016 14:54:01 +0000
treeherdermozilla-central@08efaee1d568 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsilverberg
bugs1287007
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287007 - Fix test_ext_management_uninstall_self.js r=bsilverberg The test logic was broken by design: Two tests uninstall the addon, but only one uninstall observer was used. Consequently, the second test resumes the test before the addon was actually uninstalled. It is probably sheer luck that the test worked before. MozReview-Commit-ID: DcT48ZQ2bRp
toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
@@ -14,17 +14,17 @@ const manifest = {
     gecko: {
       id,
     },
   },
   name: "test extension name",
   version: "1.0",
 };
 
-const waitForUninstalled = new Promise(resolve => {
+const waitForUninstalled = () => new Promise(resolve => {
   const listener = {
     onUninstalled: (addon) => {
       equal(addon.id, id, "The expected add-on has been uninstalled");
       AddonManager.getAddonByID(addon.id, checkedAddon => {
         equal(checkedAddon, null, "Add-on no longer exists");
         AddonManager.removeAddonListener(listener);
         resolve();
       });
@@ -62,17 +62,17 @@ add_task(function* test_management_unins
     background,
     useAddonManager: "temporary",
   });
 
   yield extension.startup();
   let addon = yield promiseAddonByID(id);
   notEqual(addon, null, "Add-on is installed");
   extension.sendMessage("uninstall");
-  yield waitForUninstalled;
+  yield waitForUninstalled();
   yield extension.markUnloaded();
   Services.obs.notifyObservers(extension.extension.file, "flush-cache-entry", null);
 });
 
 add_task(function* test_management_uninstall_prompt_uninstall() {
   promptService._response = 0;
 
   function background() {
@@ -86,17 +86,17 @@ add_task(function* test_management_unins
     background,
     useAddonManager: "temporary",
   });
 
   yield extension.startup();
   let addon = yield promiseAddonByID(id);
   notEqual(addon, null, "Add-on is installed");
   extension.sendMessage("uninstall");
-  yield waitForUninstalled;
+  yield waitForUninstalled();
   yield extension.markUnloaded();
 
   // Test localization strings
   equal(promptService._confirmExArgs[1], `Uninstall ${manifest.name}`);
   equal(promptService._confirmExArgs[2],
         `The extension “${manifest.name}” is requesting to be uninstalled. What would you like to do?`);
   equal(promptService._confirmExArgs[4], "Uninstall");
   equal(promptService._confirmExArgs[5], "Keep Installed");