Bug 1510620 - Migrate aboutdebugging tests using legacy addons to webextensions;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 30 Nov 2018 09:12:19 +0000
changeset 448959 1f77d2e610e24d08d28411c919829fe7d566777e
parent 448958 8e37b680ffbee7909c025c15ddb4c873419caf11
child 448960 481a655f835e07fa9e533ba27b92d10ed784f11c
push id35139
push userccoroiu@mozilla.com
push dateSat, 01 Dec 2018 02:30:08 +0000
treeherdermozilla-central@22425b629a9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1510620
milestone65.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 1510620 - Migrate aboutdebugging tests using legacy addons to webextensions;r=ochameau The browser_addons_debug_bootstrapped addon is completely removed because it is already covered for webextensions with browser_addons_debug_webextensions.js Other have either been migrated to use webextensions. Differential Revision: https://phabricator.services.mozilla.com/D13255
devtools/client/aboutdebugging/test/addons/unpacked/bootstrap.js
devtools/client/aboutdebugging/test/addons/unpacked/install.rdf
devtools/client/aboutdebugging/test/addons/unpacked/manifest.json
devtools/client/aboutdebugging/test/browser.ini
devtools/client/aboutdebugging/test/browser_addons_debug_bootstrapped.js
devtools/client/aboutdebugging/test/browser_addons_debug_info.js
devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js
devtools/client/aboutdebugging/test/browser_addons_install.js
devtools/client/aboutdebugging/test/browser_addons_reload.js
devtools/client/aboutdebugging/test/browser_addons_remove.js
devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js
devtools/client/aboutdebugging/test/head.js
deleted file mode 100644
--- a/devtools/client/aboutdebugging/test/addons/unpacked/bootstrap.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* eslint-env browser */
-/* exported startup, shutdown, install, uninstall */
-
-"use strict";
-
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-// This function is called from the webconsole test:
-// browser_addons_debug_bootstrapped.js
-function myBootstrapAddonFunction() { // eslint-disable-line no-unused-vars
-  Services.obs.notifyObservers(null, "addon-console-works");
-}
-
-function startup() {
-  Services.obs.notifyObservers(null, "test-devtools");
-}
-function shutdown() {}
-function install() {}
-function uninstall() {}
deleted file mode 100644
--- a/devtools/client/aboutdebugging/test/addons/unpacked/install.rdf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
--->
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-  <Description about="urn:mozilla:install-manifest"
-               em:id="test-devtools@mozilla.org"
-               em:name="test-devtools"
-               em:version="1.0"
-               em:type="2"
-               em:creator="Mozilla">
-
-    <em:bootstrap>true</em:bootstrap>
-    <em:targetApplication>
-      <Description>
-        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
-        <em:minVersion>44.0a1</em:minVersion>
-        <em:maxVersion>*</em:maxVersion>
-      </Description>
-    </em:targetApplication>
-  </Description>
-</RDF>
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/unpacked/manifest.json
@@ -0,0 +1,10 @@
+{
+  "manifest_version": 2,
+  "name": "test-devtools",
+  "version": "1.0",
+  "applications": {
+    "gecko": {
+      "id": "test-devtools@mozilla.org"
+    }
+  }
+}
--- a/devtools/client/aboutdebugging/test/browser.ini
+++ b/devtools/client/aboutdebugging/test/browser.ini
@@ -1,15 +1,14 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   head.js
-  addons/unpacked/bootstrap.js
-  addons/unpacked/install.rdf
+  addons/unpacked/manifest.json
   addons/bad/manifest.json
   addons/bug1273184.xpi
   addons/test-devtools-webextension/*
   addons/test-devtools-webextension-nobg/*
   addons/test-devtools-webextension-noid/*
   addons/test-devtools-webextension-unknown-prop/*
   service-workers/delay-sw.html
   service-workers/delay-sw.js
@@ -17,40 +16,32 @@ support-files =
   service-workers/empty-sw.js
   service-workers/fetch-sw.html
   service-workers/fetch-sw.js
   service-workers/push-sw.html
   service-workers/push-sw.js
   !/devtools/client/shared/test/shared-head.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
 
-[browser_addons_debug_bootstrapped.js]
-# To be removed in bug 1497264
-skip-if = true
 [browser_addons_debug_info.js]
 [browser_addons_debug_webextension.js]
 tags = webextensions
 [browser_addons_debug_webextension_inspector.js]
 tags = webextensions
 [browser_addons_debug_webextension_nobg.js]
 tags = webextensions
 [browser_addons_debug_webextension_popup.js]
 skip-if = (verify && debug) || (debug && os == "linux" && bits == 64) # verify: crashes on shutdown, timeouts linux debug Bug 1299001
 tags = webextensions
 [browser_addons_debugging_initial_state.js]
-# To be removed or updated in bug 1497264
-skip-if = true
 [browser_addons_install.js]
-# To be updated in bug 1497264 (was "verify && debug")
-skip-if = true
+skip-if = verify && debug
 [browser_addons_reload.js]
 [browser_addons_remove.js]
 [browser_addons_toggle_debug.js]
-# To be removed or updated in bug 1497264
-skip-if = true
 [browser_page_not_found.js]
 [browser_service_workers.js]
 [browser_service_workers_fetch_flag.js]
 skip-if = os == 'mac' # bug 1333759
 [browser_service_workers_multi_content_process.js]
 skip-if = !e10s # This test is only valid in e10s
 [browser_service_workers_not_compatible.js]
 [browser_service_workers_push.js]
deleted file mode 100644
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_bootstrapped.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-// There are shutdown issues for which multiple rejections are left uncaught.
-// See bug 1018184 for resolving these issues.
-const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
-PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
-
-// Avoid test timeouts that can occur while waiting for the "addon-console-works" message.
-requestLongerTimeout(2);
-
-const ADDON_ID = "test-devtools@mozilla.org";
-const ADDON_NAME = "test-devtools";
-
-const { BrowserToolboxProcess } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
-
-add_task(async function() {
-  await new Promise(resolve => {
-    const options = {"set": [
-      // Force enabling of addons debugging
-      ["devtools.chrome.enabled", true],
-      ["devtools.debugger.remote-enabled", true],
-      // Disable security prompt
-      ["devtools.debugger.prompt-connection", false],
-      // Enable Browser toolbox test script execution via env variable
-      ["devtools.browser-toolbox.allow-unsafe-script", true],
-    ]};
-    SpecialPowers.pushPrefEnv(options, resolve);
-  });
-
-  const { tab, document } = await openAboutDebugging("addons");
-  await waitForInitialAddonList(document);
-  await installAddon({
-    document,
-    path: "addons/unpacked/install.rdf",
-    name: ADDON_NAME,
-  });
-
-  // Retrieve the DEBUG button for the addon
-  const names = getInstalledAddonNames(document);
-  const name = names.filter(element => element.textContent === ADDON_NAME)[0];
-  ok(name, "Found the addon in the list");
-  const targetElement = name.parentNode.parentNode;
-  const debugBtn = targetElement.querySelector(".debug-button");
-  ok(debugBtn, "Found its debug button");
-
-  // Wait for a notification sent by a script evaluated the test addon via
-  // the web console.
-  const onCustomMessage = new Promise(done => {
-    Services.obs.addObserver(function listener() {
-      Services.obs.removeObserver(listener, "addon-console-works");
-      done();
-    }, "addon-console-works");
-  });
-
-  // Be careful, this JS function is going to be executed in the addon toolbox,
-  // which lives in another process. So do not try to use any scope variable!
-  const env = Cc["@mozilla.org/process/environment;1"]
-              .getService(Ci.nsIEnvironment);
-  const testScript = function() {
-    /* eslint-disable no-undef */
-    toolbox.selectTool("webconsole")
-      .then(console => {
-        const { jsterm } = console.hud;
-        return jsterm.execute("myBootstrapAddonFunction()");
-      })
-      .then(() => toolbox.destroy());
-    /* eslint-enable no-undef */
-  };
-  env.set("MOZ_TOOLBOX_TEST_SCRIPT", "new " + testScript);
-  registerCleanupFunction(() => {
-    env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
-  });
-
-  const onToolboxClose = BrowserToolboxProcess.once("close");
-
-  debugBtn.click();
-
-  await onCustomMessage;
-  ok(true, "Received the notification message from the bootstrap.js function");
-
-  await onToolboxClose;
-  ok(true, "Addon toolbox closed");
-
-  await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME});
-  await closeAboutDebugging(tab);
-});
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
@@ -8,39 +8,16 @@ const SHOW_SYSTEM_ADDONS_PREF = "devtool
 function testFilePath(container, expectedFilePath) {
   // Verify that the path to the install location is shown next to its label.
   const filePath = container.querySelector(".file-path");
   ok(filePath, "file path is in DOM");
   ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly");
   is(filePath.previousElementSibling.textContent, "Location", "file path has label");
 }
 
-// Remove in Bug 1497264
-/*
-add_task(async function testLegacyAddon() {
-  const addonId = "test-devtools@mozilla.org";
-  const addonName = "test-devtools";
-  const { tab, document } = await openAboutDebugging("addons");
-  await waitForInitialAddonList(document);
-
-  await installAddon({
-    document,
-    path: "addons/unpacked/install.rdf",
-    name: addonName,
-  });
-
-  const container = document.querySelector(`[data-addon-id="${addonId}"]`);
-  testFilePath(container, "browser/devtools/client/aboutdebugging/test/addons/unpacked/");
-
-  await uninstallAddon({document, id: addonId, name: addonName});
-
-  await closeAboutDebugging(tab);
-});
-*/
-
 add_task(async function testWebExtension() {
   const addonId = "test-devtools-webextension-nobg@mozilla.org";
   const addonName = "test-devtools-webextension-nobg";
   const { tab, document } = await openAboutDebugging("addons");
 
   await waitForInitialAddonList(document);
 
   const addonFile = ExtensionTestCommon.generateXPI({
@@ -52,17 +29,16 @@ add_task(async function testWebExtension
     },
   });
   registerCleanupFunction(() => addonFile.remove(false));
 
   await installAddon({
     document,
     file: addonFile,
     name: addonName,
-    isWebExtension: true,
   });
 
   const container = document.querySelector(`[data-addon-id="${addonId}"]`);
 
   testFilePath(container, addonFile.leafName);
 
   const extensionID = container.querySelector(".extension-id span");
   ok(extensionID.textContent === "test-devtools-webextension-nobg@mozilla.org");
@@ -90,17 +66,16 @@ add_task(async function testTemporaryWeb
     },
   });
   registerCleanupFunction(() => addonFile.remove(false));
 
   await installAddon({
     document,
     file: addonFile,
     name: addonName,
-    isWebExtension: true,
   });
 
   const addons =
     document.querySelectorAll("#temporary-extensions .addon-target-container");
   // Assuming that our temporary add-on is now at the top.
   const container = addons[addons.length - 1];
   const addonId = container.dataset.addonId;
 
@@ -133,17 +108,16 @@ add_task(async function testUnknownManif
     },
   });
   registerCleanupFunction(() => addonFile.remove(false));
 
   await installAddon({
     document,
     file: addonFile,
     name: addonName,
-    isWebExtension: true,
   });
 
   info("Wait until the addon appears in about:debugging");
   const container = await waitUntilAddonContainer(addonName, document);
 
   info("Wait until the installation message appears for the new addon");
   await waitUntilElement(".addon-target-messages", container);
 
--- a/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js
@@ -47,17 +47,17 @@ async function testCheckboxState(testDat
   });
 
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   info("Install a test addon.");
   await installAddon({
     document,
-    path: "addons/unpacked/install.rdf",
+    path: "addons/unpacked/manifest.json",
     name: ADDON_NAME,
   });
 
   info("Test checkbox checked state.");
   const addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
   is(addonDebugCheckbox.checked, testData.expected,
     "Addons debugging checkbox should be in expected state.");
 
--- a/devtools/client/aboutdebugging/test/browser_addons_install.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_install.js
@@ -26,32 +26,33 @@ function mockFilePicker(window, file) {
 function promiseWriteWebManifestForExtension(manifest, dir) {
   const files = {
     "manifest.json": JSON.stringify(manifest),
   };
   return AddonTestUtils.promiseWriteFilesToExtension(
     dir.path, manifest.applications.gecko.id, files, true);
 }
 
-add_task(async function testLegacyInstallSuccess() {
-  const ADDON_ID = "test-devtools@mozilla.org";
-  const ADDON_NAME = "test-devtools";
-
+add_task(async function testWebextensionInstallSuccess() {
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   // Install this add-on, and verify that it appears in the about:debugging UI
   await installAddon({
     document,
-    path: "addons/unpacked/install.rdf",
-    name: ADDON_NAME,
+    path: "addons/unpacked/manifest.json",
+    name: "test-devtools",
   });
 
   // Install the add-on, and verify that it disappears in the about:debugging UI
-  await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME});
+  await uninstallAddon({
+    document,
+    id: "test-devtools@mozilla.org",
+    name: "test-devtools",
+  });
 
   await closeAboutDebugging(tab);
 });
 
 add_task(async function testWebextensionInstallError() {
   const { tab, document, window } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
--- a/devtools/client/aboutdebugging/test/browser_addons_reload.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_reload.js
@@ -63,43 +63,39 @@ class TempWebExt {
 /*
 add_task(async function reloadButtonReloadsAddon() {
   const ADDON_NAME = "test-devtools";
   const { tab, document, window } = await openAboutDebugging("addons");
   const { AboutDebugging } = window;
   await waitForInitialAddonList(document);
   await installAddon({
     document,
-    path: "addons/unpacked/install.rdf",
+    path: "addons/unpacked/manifest.json",
     name: ADDON_NAME,
   });
 
   const reloadButton = getReloadButton(document, ADDON_NAME);
   is(reloadButton.title, "", "Reload button should not have a tooltip");
   const onInstalled = promiseAddonEvent("onInstalled");
 
-  const onBootstrapInstallCalled = new Promise(done => {
-    Services.obs.addObserver(function listener() {
-      Services.obs.removeObserver(listener, ADDON_NAME);
-      info("Add-on was re-installed: " + ADDON_NAME);
-      done();
-    }, ADDON_NAME);
-  });
+  const reloaded = once(AboutDebugging, "addon-reload");
 
-  const reloaded = once(AboutDebugging, "addon-reload");
-  const onListUpdated = once(AboutDebugging, "addons-updated");
+  // The list is updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event
+  const onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
+
   reloadButton.click();
   await reloaded;
   await onListUpdated;
 
   const [reloadedAddon] = await onInstalled;
   is(reloadedAddon.name, ADDON_NAME,
      "Add-on was reloaded: " + reloadedAddon.name);
 
-  await onBootstrapInstallCalled;
   await tearDownAddon(AboutDebugging, reloadedAddon);
   await closeAboutDebugging(tab);
 });
 */
 
 add_task(async function reloadButtonRefreshesMetadata() {
   const { tab, document, window } = await openAboutDebugging("addons");
   const { AboutDebugging } = window;
@@ -114,34 +110,36 @@ add_task(async function reloadButtonRefr
         "id": ADDON_ID,
       },
     },
   };
 
   const tempExt = new TempWebExt(ADDON_ID);
   tempExt.writeManifest(manifestBase);
 
-  // The list is updated twice. On AddonManager's onInstalled event as well
-  // as WebExtension's Management's startup event.
+  // List updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event.
   let onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
   const onInstalled = promiseAddonEvent("onInstalled");
   await AddonManager.installTemporaryAddon(tempExt.sourceDir);
   await onListUpdated;
 
   info("Wait until addon onInstalled event is received");
   await onInstalled;
 
   info("Wait until addon appears in about:debugging#addons");
   await waitUntilAddonContainer("Temporary web extension", document);
 
   const newName = "Temporary web extension (updated)";
   tempExt.writeManifest(Object.assign({}, manifestBase, {name: newName}));
 
-  // The list is updated twice, once for uninstall of the old
-  // and another one for install of the new
+  // List updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event.
   onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
   // Wait for the add-on list to be updated with the reloaded name.
   const onReInstall = promiseAddonEvent("onInstalled");
   const reloadButton = getReloadButton(document, manifestBase.name);
   const reloaded = once(AboutDebugging, "addon-reload");
   reloadButton.click();
   await reloaded;
   await onListUpdated;
@@ -157,18 +155,19 @@ add_task(async function reloadButtonRefr
   await closeAboutDebugging(tab);
 });
 
 add_task(async function onlyTempInstalledAddonsCanBeReloaded() {
   const { tab, document, window } = await openAboutDebugging("addons");
   const { AboutDebugging } = window;
   await waitForInitialAddonList(document);
 
-  // The list is updated twice. On AddonManager's onInstalled event as well
-  // as WebExtension's Management's startup event.
+  // List updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event.
   const onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
   await installAddonWithManager(getSupportsFile("addons/bug1273184.xpi").file);
   await onListUpdated;
 
   info("Wait until addon appears in about:debugging#addons");
   await waitUntilAddonContainer(PACKAGED_ADDON_NAME, document);
 
   info("Retrieved the installed addon from the addon manager");
--- a/devtools/client/aboutdebugging/test/browser_addons_remove.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_remove.js
@@ -7,44 +7,16 @@ const PACKAGED_ADDON_NAME = "bug 1273184
 function getTargetEl(document, id) {
   return document.querySelector(`[data-addon-id="${id}"]`);
 }
 
 function getRemoveButton(document, id) {
   return document.querySelector(`[data-addon-id="${id}"] .uninstall-button`);
 }
 
-// Remove in Bug 1497264
-/*
-add_task(async function removeLegacyExtension() {
-  const addonID = "test-devtools@mozilla.org";
-  const addonName = "test-devtools";
-
-  const { tab, document } = await openAboutDebugging("addons");
-  await waitForInitialAddonList(document);
-
-  // Install this add-on, and verify that it appears in the about:debugging UI
-  await installAddon({
-    document,
-    path: "addons/unpacked/install.rdf",
-    name: addonName,
-  });
-
-  ok(getTargetEl(document, addonID), "add-on is shown");
-
-  info("Click on the remove button and wait until the addon container is removed");
-  getRemoveButton(document, addonID).click();
-  await waitUntil(() => !getTargetEl(document, addonID), 100);
-
-  info("add-on is not shown");
-
-  await closeAboutDebugging(tab);
-});
-*/
-
 add_task(async function removeWebextension() {
   const addonID = "test-devtools-webextension@mozilla.org";
   const addonName = "test-devtools-webextension";
 
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   const addonFile = ExtensionTestCommon.generateXPI({
@@ -57,17 +29,16 @@ add_task(async function removeWebextensi
   });
   registerCleanupFunction(() => addonFile.remove(false));
 
   // Install this add-on, and verify that it appears in the about:debugging UI
   await installAddon({
     document,
     file: addonFile,
     name: addonName,
-    isWebExtension: true,
   });
 
   ok(getTargetEl(document, addonID), "add-on is shown");
 
   info("Click on the remove button and wait until the addon container is removed");
   getRemoveButton(document, addonID).click();
   await waitUntil(() => !getTargetEl(document, addonID), 100);
 
@@ -76,18 +47,19 @@ add_task(async function removeWebextensi
   await closeAboutDebugging(tab);
 });
 
 add_task(async function onlyTempInstalledAddonsCanBeRemoved() {
   const { tab, document, window } = await openAboutDebugging("addons");
   const { AboutDebugging } = window;
   await waitForInitialAddonList(document);
 
-  // The list is updated twice. On AddonManager's onInstalled event as well
-  // as WebExtension's Management's startup event.
+  // List updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event.
   const onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
   await installAddonWithManager(getSupportsFile("addons/bug1273184.xpi").file);
   await onListUpdated;
   const addon = await getAddonByID("bug1273184@tests");
 
   info("Wait until addon appears in about:debugging#addons");
   await waitUntilAddonContainer(PACKAGED_ADDON_NAME, document);
 
--- a/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js
@@ -20,17 +20,17 @@ add_task(async function() {
   });
 
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   info("Install a test addon.");
   await installAddon({
     document,
-    path: "addons/unpacked/install.rdf",
+    path: "addons/unpacked/manifest.json",
     name: ADDON_NAME,
   });
 
   const addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
   ok(!addonDebugCheckbox.checked, "Addons debugging should be disabled.");
 
   info("Check all debug buttons are disabled.");
   const debugButtons = [...document.querySelectorAll("#addons .debug-button")];
--- a/devtools/client/aboutdebugging/test/head.js
+++ b/devtools/client/aboutdebugging/test/head.js
@@ -161,53 +161,48 @@ async function waitUntilElement(selector
  * @param  {DOMDocument}  document   #tabs section container document
  * @return {DOMNode}                 target list or container element
  */
 function getTabList(document) {
   return document.querySelector("#tabs .target-list") ||
     document.querySelector("#tabs.targets");
 }
 
-async function installAddon({document, path, file, name, isWebExtension}) {
+async function installAddon({document, path, file, name}) {
   // Mock the file picker to select a test addon
   const MockFilePicker = SpecialPowers.MockFilePicker;
   MockFilePicker.init(window);
   if (path) {
     file = getSupportsFile(path);
     MockFilePicker.setFiles([file.file]);
   } else {
     MockFilePicker.setFiles([file]);
   }
 
-  let onAddonInstalled;
-
-  if (isWebExtension) {
-    onAddonInstalled = new Promise(done => {
-      Management.on("startup", function listener(event, extension) {
-        if (extension.name != name) {
-          return;
-        }
+  const onAddonInstalled = new Promise(done => {
+    Management.on("startup", function listener(event, extension) {
+      if (extension.name != name) {
+        return;
+      }
 
-        Management.off("startup", listener);
-        done();
-      });
+      Management.off("startup", listener);
+      done();
     });
-  } else {
-    // Wait for a "test-devtools" message sent by the addon's bootstrap.js file
-    onAddonInstalled = new Promise(done => {
-      Services.obs.addObserver(function listener() {
-        Services.obs.removeObserver(listener, "test-devtools");
+  });
+  const AboutDebugging = document.defaultView.AboutDebugging;
 
-        done();
-      }, "test-devtools");
-    });
-  }
+  // List updated twice:
+  // - AddonManager's onInstalled event
+  // - WebExtension's Management's startup event.
+  const onListUpdated = waitForNEvents(AboutDebugging, "addons-updated", 2);
+
   // Trigger the file picker by clicking on the button
   document.getElementById("load-addon-from-file").click();
 
+  await onListUpdated;
   await onAddonInstalled;
   ok(true, "Addon installed and running its bootstrap.js file");
 
   info("Wait for the addon to appear in the UI");
   await waitUntilAddonContainer(name, document);
 }
 
 async function uninstallAddon({document, id, name}) {
@@ -362,17 +357,16 @@ async function setupTestAboutDebuggingWe
 
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   await installAddon({
     document,
     file,
     name,
-    isWebExtension: true,
   });
 
   // Retrieve the DEBUG button for the addon
   const names = getInstalledAddonNames(document);
   const nameEl = names.filter(element => element.textContent === name)[0];
   ok(name, "Found the addon in the list");
   const targetElement = nameEl.parentNode.parentNode;
   const debugBtn = targetElement.querySelector(".debug-button");