Bug 1398908 - Add automated test that uses nonexistent script from extension JAR file. r=mixedpuppy
☠☠ backed out by 7f158a80dea9 ☠ ☠
authorHaik Aftandilian <haftandilian@mozilla.com>
Tue, 03 Oct 2017 16:09:03 -0700
changeset 386858 513578be7da23c6259c78d1351bc02d0c424514e
parent 386857 df6a6d54cdbbf8990f2aa2c293a1616f802d2faa
child 386859 edc055534a733ff284e8b0e05f2c27560e55b2d4
push id96311
push userarchaeopteryx@coole-files.de
push dateWed, 18 Oct 2017 09:52:02 +0000
treeherdermozilla-inbound@a8a1e8cc1980 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1398908
milestone58.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 1398908 - Add automated test that uses nonexistent script from extension JAR file. r=mixedpuppy MozReview-Commit-ID: DbZ3JuFm770
toolkit/components/extensions/test/xpcshell/test_ext_brokenlinks.js
toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_brokenlinks.js
@@ -0,0 +1,55 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+/*
+ * This test extension has a background script 'missing.js' that is missing
+ * from the XPI. Such an extension should install/uninstall cleanly without
+ * causing timeouts.
+ */
+add_task(async function testXPIMissingBackGroundScript() {
+  let extension = ExtensionTestUtils.loadExtension({
+    manifest: {
+      "background": {
+        "scripts": ["missing.js"],
+        "persistent": false
+      }
+    },
+  });
+
+  await extension.startup();
+  await extension.unload();
+  ok(true, "load/unload completed without timing out");
+});
+
+/*
+ * This test extension includes a page with a missing script. The
+ * extension should install/uninstall cleanly without causing hangs.
+ */
+add_task(async function testXPIMissingPageScript() {
+  async function pageScript() {
+    browser.test.sendMessage("pageReady");
+  }
+
+  let extension = ExtensionTestUtils.loadExtension({
+    background() {
+      browser.test.sendMessage("ready", browser.runtime.getURL("page.html"));
+    },
+    files: {
+      "page.html": `<html><head>
+                    <script src="missing.js"></script>
+                    <script src="page.js"></script>
+                    </head></html>`,
+      "page.js": pageScript,
+    },
+  });
+
+  await extension.startup();
+  let url = await extension.awaitMessage("ready");
+  let contentPage = await ExtensionTestUtils.loadContentPage(url);
+  await extension.awaitMessage("pageReady");
+  await extension.unload();
+  await contentPage.close();
+
+  ok(true, "load/unload completed without timing out");
+});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
@@ -78,8 +78,9 @@ skip-if = os == "android"
 [test_native_manifests.js]
 subprocess = true
 skip-if = os == "android"
 [test_ext_permissions.js]
 skip-if = os == "android" # Bug 1350559
 [test_proxy_scripts.js]
 skip-if = os == "linux" # bug 1393940
 [test_proxy_scripts_results.js]
+[test_ext_brokenlinks.js]