Backed out changeset b062b1682bbd (bug 1495855) for failures on browser_addons_debug_info.js. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Wed, 17 Oct 2018 19:23:45 +0300
changeset 500167 39b4f60d3b07d074468898f71beccf4159f12e27
parent 500166 8b15bab9cde939cc2f79e43e8e1890dae04f8ad3
child 500170 6bd88a7285587170add932d4e8558bf5444386ec
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1495855
milestone64.0a1
backs outb062b1682bbd328a0327edf51f9040dcd9e1680a
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
Backed out changeset b062b1682bbd (bug 1495855) for failures on browser_addons_debug_info.js. CLOSED TREE
devtools/client/aboutdebugging/test/addons/test-devtools-webextension-nobg/manifest.json
devtools/client/aboutdebugging/test/addons/test-devtools-webextension-noid/manifest.json
devtools/client/aboutdebugging/test/addons/test-devtools-webextension-unknown-prop/manifest.json
devtools/client/aboutdebugging/test/addons/test-devtools-webextension/bg.js
devtools/client/aboutdebugging/test/addons/test-devtools-webextension/manifest.json
devtools/client/aboutdebugging/test/addons/test-devtools-webextension/popup.html
devtools/client/aboutdebugging/test/addons/test-devtools-webextension/popup.js
devtools/client/aboutdebugging/test/browser_addons_debug_info.js
devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js
devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js
devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js
devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js
devtools/client/aboutdebugging/test/browser_addons_remove.js
devtools/client/aboutdebugging/test/head.js
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension-nobg/manifest.json
@@ -0,0 +1,10 @@
+{
+  "manifest_version": 2,
+  "name": "test-devtools-webextension-nobg",
+  "version": "1.0",
+  "applications": {
+    "gecko": {
+      "id": "test-devtools-webextension-nobg@mozilla.org"
+    }
+  }
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension-noid/manifest.json
@@ -0,0 +1,5 @@
+{
+  "manifest_version": 2,
+  "name": "test-devtools-webextension-noid",
+  "version": "1.0"
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension-unknown-prop/manifest.json
@@ -0,0 +1,14 @@
+{
+  "manifest_version": 2,
+  "name": "test-devtools-webextension-unknown-prop",
+  "version": "1.0",
+  "applications": {
+    "gecko": {
+      "id": "test-devtools-webextension-unknown-prop@mozilla.org"
+    }
+  },
+  "browser_actions": {
+    "default_title": "WebExtension Popup Debugging",
+    "default_popup": "popup.html"
+  }
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension/bg.js
@@ -0,0 +1,23 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* eslint-env browser */
+/* global browser */
+
+"use strict";
+
+document.body.innerText = "Background Page Body Test Content";
+
+// These functions are called from the following about:debugging tests:
+// - browser_addons_debug_webextension.js
+// - browser_addons_debug_webextension_popup.js
+
+// eslint-disable-next-line no-unused-vars
+function myWebExtensionAddonFunction() {
+  console.log("Background page function called", browser.runtime.getManifest());
+}
+
+// eslint-disable-next-line no-unused-vars
+function myWebExtensionShowPopup() {
+  browser.test.sendMessage("readyForOpenPopup");
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension/manifest.json
@@ -0,0 +1,17 @@
+{
+  "manifest_version": 2,
+  "name": "test-devtools-webextension",
+  "version": "1.0",
+  "applications": {
+    "gecko": {
+      "id": "test-devtools-webextension@mozilla.org"
+    }
+  },
+  "background": {
+    "scripts": ["bg.js"]
+  },
+  "browser_action": {
+    "default_title": "WebExtension Popup Debugging",
+    "default_popup": "popup.html"
+  }
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension/popup.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <script src="popup.js"></script>
+  </head>
+  <body>
+    Background Page Body Test Content
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/addons/test-devtools-webextension/popup.js
@@ -0,0 +1,15 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* eslint-env browser */
+/* global browser */
+
+"use strict";
+
+// This function is called from the following about:debugging test:
+// browser_addons_debug_webextension.js
+//
+// eslint-disable-next-line no-unused-vars
+function myWebExtensionPopupAddonFunction() {
+  browser.test.sendMessage("popupPageFunctionCalled", browser.runtime.getManifest());
+}
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
@@ -34,37 +34,25 @@ add_task(async function testLegacyAddon(
 });
 
 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({
-    manifest: {
-      name: addonName,
-      applications: {
-        gecko: {id: addonId},
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   await installAddon({
     document,
-    file: addonFile,
+    path: "addons/test-devtools-webextension-nobg/manifest.json",
     name: addonName,
     isWebExtension: true
   });
 
   const container = document.querySelector(`[data-addon-id="${addonId}"]`);
-
-  testFilePath(container, addonFile.path);
+  testFilePath(container, "/test/addons/test-devtools-webextension-nobg/");
 
   const extensionID = container.querySelector(".extension-id span");
   ok(extensionID.textContent === "test-devtools-webextension-nobg@mozilla.org");
 
   const internalUUID = container.querySelector(".internal-uuid span");
   ok(internalUUID.textContent.match(UUID_REGEX), "internalUUID is correct");
 
   const manifestURL = container.querySelector(".manifest-url");
@@ -75,27 +63,19 @@ add_task(async function testWebExtension
   await closeAboutDebugging(tab);
 });
 
 add_task(async function testTemporaryWebExtension() {
   const addonName = "test-devtools-webextension-noid";
   const { tab, document } = await openAboutDebugging("addons");
 
   await waitForInitialAddonList(document);
-
-  const addonFile = ExtensionTestCommon.generateXPI({
-    manifest: {
-      name: addonName,
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   await installAddon({
     document,
-    file: addonFile,
+    path: "addons/test-devtools-webextension-noid/manifest.json",
     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];
@@ -113,45 +93,32 @@ add_task(async function testTemporaryWeb
 });
 
 add_task(async function testUnknownManifestProperty() {
   const addonId = "test-devtools-webextension-unknown-prop@mozilla.org";
   const addonName = "test-devtools-webextension-unknown-prop";
   const { tab, document } = await openAboutDebugging("addons");
 
   await waitForInitialAddonList(document);
-
-  const addonFile = ExtensionTestCommon.generateXPI({
-    manifest: {
-      name: addonName,
-      applications: {
-        gecko: {id: addonId},
-      },
-      wrong_manifest_property_name: {
-      }
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   await installAddon({
     document,
-    file: addonFile,
+    path: "addons/test-devtools-webextension-unknown-prop/manifest.json",
     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);
 
   const messages = container.querySelectorAll(".addon-target-message");
   ok(messages.length === 1, "there is one message");
-  ok(messages[0].textContent.match(/Error processing wrong_manifest_property_name/),
+  ok(messages[0].textContent.match(/Error processing browser_actions/),
      "the message is helpful");
   ok(messages[0].classList.contains("addon-target-warning-message"),
      "the message is a warning");
 
   await uninstallAddon({document, id: addonId, name: addonName});
 
   await closeAboutDebugging(tab);
 });
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js
@@ -8,46 +8,31 @@
 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-webextension@mozilla.org";
 const ADDON_NAME = "test-devtools-webextension";
+const ADDON_MANIFEST_PATH = "addons/test-devtools-webextension/manifest.json";
 
 const {
   BrowserToolboxProcess
 } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
 
 /**
  * This test file ensures that the webextension addon developer toolbox:
  * - when the debug button is clicked on a webextension, the opened toolbox
  *   has a working webconsole with the background page as default target;
  */
 add_task(async function testWebExtensionsToolboxWebConsole() {
-  const addonFile = ExtensionTestCommon.generateXPI({
-    background: function() {
-      window.myWebExtensionAddonFunction = function() {
-        console.log("Background page function called",
-                    this.browser.runtime.getManifest());
-      };
-    },
-    manifest: {
-      name: ADDON_NAME,
-      applications: {
-        gecko: {id: ADDON_ID},
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   const {
     tab, document, debugBtn,
-  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile);
+  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_MANIFEST_PATH);
 
   // 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 */
     function findMessages(hud, text, selector = ".message") {
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js
@@ -7,43 +7,31 @@
 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-webextension@mozilla.org";
 const ADDON_NAME = "test-devtools-webextension";
+const ADDON_PATH = "addons/test-devtools-webextension/manifest.json";
 
 const {
   BrowserToolboxProcess
 } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
 
 /**
  * This test file ensures that the webextension addon developer toolbox:
  * - the webextension developer toolbox has a working Inspector panel, with the
  *   background page as default target;
  */
 add_task(async function testWebExtensionsToolboxInspector() {
-  const addonFile = ExtensionTestCommon.generateXPI({
-    background: function() {
-      document.body.innerText = "Background Page Body Test Content";
-    },
-    manifest: {
-      name: ADDON_NAME,
-      applications: {
-        gecko: {id: ADDON_ID},
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   const {
     tab, document, debugBtn,
-  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile);
+  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_PATH);
 
   // 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("inspector")
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js
@@ -7,80 +7,75 @@
 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_NOBG_ID = "test-devtools-webextension-nobg@mozilla.org";
 const ADDON_NOBG_NAME = "test-devtools-webextension-nobg";
+const ADDON_NOBG_PATH = "addons/test-devtools-webextension-nobg/manifest.json";
 
 const {
   BrowserToolboxProcess
 } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
 
 /**
  * This test file ensures that the webextension addon developer toolbox:
  * - the webextension developer toolbox is connected to a fallback page when the
  *   background page is not available (and in the fallback page document body contains
  *   the expected message, which warns the user that the current page is not a real
  *   webextension context);
  */
 add_task(async function testWebExtensionsToolboxNoBackgroundPage() {
-  const addonFile = ExtensionTestCommon.generateXPI({
-    manifest: {
-      name: ADDON_NOBG_NAME,
-      applications: {
-        gecko: {id: ADDON_NOBG_ID},
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   const {
     tab, document, debugBtn,
-  } = await setupTestAboutDebuggingWebExtension(ADDON_NOBG_NAME, addonFile);
+  } = await setupTestAboutDebuggingWebExtension(ADDON_NOBG_NAME, ADDON_NOBG_PATH);
 
   // 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("inspector").then(async inspector => {
-      const nodeActor = await inspector.walker.querySelector(
-        inspector.walker.rootNode, "body");
+    toolbox.selectTool("inspector")
+      .then(inspector => {
+        return inspector.walker.querySelector(inspector.walker.rootNode, "body");
+      })
+      .then((nodeActor) => {
+        if (!nodeActor) {
+          throw new Error("nodeActor not found");
+        }
 
-      if (!nodeActor) {
-        throw new Error("nodeActor not found");
-      }
+        dump("Got a nodeActor\n");
 
-      if (!(nodeActor.inlineTextChild)) {
-        throw new Error("inlineTextChild not found");
-      }
+        if (!(nodeActor.inlineTextChild)) {
+          throw new Error("inlineTextChild not found");
+        }
 
-      dump("Got a nodeActor with an inline text child\n");
+        dump("Got a nodeActor with an inline text child\n");
 
-      const expectedValue = "Your addon does not have any document opened yet.";
-      const actualValue = nodeActor.inlineTextChild._form.nodeValue;
+        const expectedValue = "Your addon does not have any document opened yet.";
+        const actualValue = nodeActor.inlineTextChild._form.nodeValue;
 
-      if (actualValue !== expectedValue) {
-        throw new Error(
-          `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"`
-        );
-      }
+        if (actualValue !== expectedValue) {
+          throw new Error(
+            `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"`
+          );
+        }
 
-      dump("Got the expected inline text content in the selected node\n");
-
-      await toolbox.destroy();
-    }).catch((error) => {
-      dump("Error while running code in the browser toolbox process:\n");
-      dump(error + "\n");
-      dump("stack:\n" + error.stack + "\n");
-    });
+        dump("Got the expected inline text content in the selected node\n");
+        return Promise.resolve();
+      })
+      .then(() => toolbox.destroy())
+      .catch((error) => {
+        dump("Error while running code in the browser toolbox process:\n");
+        dump(error + "\n");
+        dump("stack:\n" + error.stack + "\n");
+      });
     /* eslint-enable no-undef */
   };
   env.set("MOZ_TOOLBOX_TEST_SCRIPT", "new " + testScript);
   registerCleanupFunction(() => {
     env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
   });
 
   const onToolboxClose = BrowserToolboxProcess.once("close");
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js
@@ -7,16 +7,17 @@
 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-webextension@mozilla.org";
 const ADDON_NAME = "test-devtools-webextension";
+const ADDON_MANIFEST_PATH = "addons/test-devtools-webextension/manifest.json";
 
 const {
   BrowserToolboxProcess
 } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
 
 /**
  * This test file ensures that the webextension addon developer toolbox:
  * - when the debug button is clicked on a webextension, the opened toolbox
@@ -36,56 +37,16 @@ const {
  * Returns the widget id for an extension with the passed id.
  */
 function makeWidgetId(id) {
   id = id.toLowerCase();
   return id.replace(/[^a-z0-9_-]/g, "_");
 }
 
 add_task(async function testWebExtensionsToolboxSwitchToPopup() {
-  const addonFile = ExtensionTestCommon.generateXPI({
-    background: function() {
-      const {browser} = this;
-      window.myWebExtensionShowPopup = function() {
-        browser.test.sendMessage("readyForOpenPopup");
-      };
-    },
-    manifest: {
-      name: ADDON_NAME,
-      applications: {
-        gecko: {id: ADDON_ID},
-      },
-      browser_action: {
-        default_title: "WebExtension Popup Debugging",
-        default_popup: "popup.html",
-      },
-    },
-    files: {
-      "popup.html": `<!DOCTYPE html>
-        <html>
-          <head>
-            <meta charset="utf-8">
-            <script src="popup.js"></script>
-          </head>
-          <body>
-            Background Page Body Test Content
-          </body>
-        </html>
-      `,
-      "popup.js": function() {
-        const {browser} = this;
-        window.myWebExtensionPopupAddonFunction = function() {
-          browser.test.sendMessage("popupPageFunctionCalled",
-                                   browser.runtime.getManifest());
-        };
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   let onReadyForOpenPopup;
   let onPopupCustomMessage;
 
   is(Services.prefs.getBoolPref("ui.popup.disable_autohide"), false,
      "disable_autohide shoult be initially false");
 
   Management.on("startup", function listener(event, extension) {
     if (extension.name != ADDON_NAME) {
@@ -115,17 +76,17 @@ add_task(async function testWebExtension
 
     // Wait for a notification sent by a script evaluated the test addon via
     // the web console.
     onPopupCustomMessage = waitForExtensionTestMessage("popupPageFunctionCalled");
   });
 
   const {
     tab, document, debugBtn,
-  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile);
+  } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_MANIFEST_PATH);
 
   // 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 */
 
--- a/devtools/client/aboutdebugging/test/browser_addons_remove.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_remove.js
@@ -39,30 +39,20 @@ add_task(async function removeLegacyExte
 
 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({
-    manifest: {
-      name: addonName,
-      applications: {
-        gecko: {id: addonID},
-      },
-    },
-  });
-  registerCleanupFunction(() => addonFile.remove(false));
-
   // Install this add-on, and verify that it appears in the about:debugging UI
   await installAddon({
     document,
-    file: addonFile,
+    path: "addons/test-devtools-webextension/manifest.json",
     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();
--- a/devtools/client/aboutdebugging/test/head.js
+++ b/devtools/client/aboutdebugging/test/head.js
@@ -9,17 +9,16 @@
 
 // Load the shared-head file first.
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
   this);
 
 const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm", {});
 const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
-const { ExtensionTestCommon } = ChromeUtils.import("resource://testing-common/ExtensionTestCommon.jsm", {});
 
 async function openAboutDebugging(page, win) {
   info("opening about:debugging");
   let url = "about:debugging";
   if (page) {
     url += "#" + page;
   }
 
@@ -161,26 +160,22 @@ 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, name, isWebExtension}) {
   // 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]);
-  }
+  const file = getSupportsFile(path);
+  MockFilePicker.setFiles([file.file]);
 
   let onAddonInstalled;
 
   if (isWebExtension) {
     onAddonInstalled = new Promise(done => {
       Management.on("startup", function listener(event, extension) {
         if (extension.name != name) {
           return;
@@ -341,17 +336,17 @@ function waitForDelayedStartupFinished(w
       }
     }, "browser-delayed-startup-finished");
   });
 }
 
 /**
  * open the about:debugging page and install an addon
  */
-async function setupTestAboutDebuggingWebExtension(name, file) {
+async function setupTestAboutDebuggingWebExtension(name, path) {
   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
@@ -360,17 +355,17 @@ async function setupTestAboutDebuggingWe
     SpecialPowers.pushPrefEnv(options, resolve);
   });
 
   const { tab, document } = await openAboutDebugging("addons");
   await waitForInitialAddonList(document);
 
   await installAddon({
     document,
-    file,
+    path,
     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");