Bug 1544928 - Fix pending uninstall extension not yet active when onOperationCancelled is fired. r=aswan
authorLuca Greco <lgreco@mozilla.com>
Mon, 06 May 2019 18:38:26 +0000
changeset 531570 dc5df04e9ce9c61d95b8e1b5e2183c8ebe0fc41b
parent 531569 407fc9248a911ea70e74e44efa709b63af804607
child 531571 692bd19485ff6f49ce7c074d9a52fa9ac2c42eec
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1544928
milestone68.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 1544928 - Fix pending uninstall extension not yet active when onOperationCancelled is fired. r=aswan Depends on D29122 Differential Revision: https://phabricator.services.mozilla.com/D29123
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/test/browser/browser_html_list_view.js
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -4025,25 +4025,24 @@ var XPIInstall = {
     if (!aAddon.visible)
       return;
 
     aAddon.location.get(aAddon.id).syncWithDB(aAddon);
     XPIStates.save();
 
     Services.prefs.setBoolPref(PREF_PENDING_OPERATIONS, true);
 
-    // TODO hide hidden add-ons (bug 557710)
-    let wrapper = aAddon.wrapper;
-    AddonManagerPrivate.callAddonListeners("onOperationCancelled", wrapper);
-
     if (!aAddon.disabled) {
       XPIInternal.BootstrapScope.get(aAddon).startup(BOOTSTRAP_REASONS.ADDON_INSTALL);
       XPIDatabase.updateAddonActive(aAddon, true);
     }
 
+    let wrapper = aAddon.wrapper;
+    AddonManagerPrivate.callAddonListeners("onOperationCancelled", wrapper);
+
     // Notify any other providers that this theme is now enabled again.
     if (aAddon.type === "theme" && aAddon.active)
       AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type, false);
   },
 
   DirectoryInstaller,
   SystemAddonInstaller,
 };
--- a/toolkit/mozapps/extensions/test/browser/browser_html_list_view.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_html_list_view.js
@@ -170,16 +170,21 @@ add_task(async function testExtensionLis
   // Addon2 was enabled before entering the pending uninstall state,
   // wait for its startup after pressing undo.
   let addon2Started = AddonTestUtils.promiseWebExtensionStartup(addon2.id);
   await testUndoPendingUninstall(list, addon);
   await testUndoPendingUninstall(list, addon2);
   info("Wait for the second pending uninstal add-ons startup");
   await addon2Started;
 
+  ok(getCardByAddonId(disabledSection, addon.id),
+     "The card for the first extension is in the disabled section");
+  ok(getCardByAddonId(enabledSection, addon2.id),
+     "The card for the second extension is in the enabled section");
+
   await extension2.unload();
   await extension.unload();
 
   // Install a third addon to verify that is being fully removed once the
   // about:addons page is closed.
   const xpi = AddonTestUtils.createTempWebExtensionFile({
     manifest: {
       name: "Test extension 3",