Bug 1500374 - Test warning messages for addons are displayed in new about:debugging;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 18 Jan 2019 14:05:15 +0000
changeset 454446 76e2d626f740cbc368018aedd3ec4a2369d4c7e7
parent 454445 1c06ef2cea48149efe62ce4e207c6fadded245fd
child 454447 53e88d5a31a7dd64100ef79cbfe8cd53df963edb
push id35397
push useropoprus@mozilla.com
push dateSat, 19 Jan 2019 03:35:41 +0000
treeherdermozilla-central@57dc8bbbc38f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1500374
milestone66.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 1500374 - Test warning messages for addons are displayed in new about:debugging;r=daisuke Depends on D16575 Differential Revision: https://phabricator.services.mozilla.com/D16576
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -24,16 +24,17 @@ support-files =
   !/devtools/client/shared/test/telemetry-test-helpers.js
 
 [browser_aboutdebugging_addons_debug_nobg.js]
 [browser_aboutdebugging_addons_manifest_url.js]
 skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
 [browser_aboutdebugging_addons_remote_runtime.js]
 [browser_aboutdebugging_addons_temporary_addon_buttons.js]
 [browser_aboutdebugging_addons_temporary_id_message.js]
+[browser_aboutdebugging_addons_warnings.js]
 [browser_aboutdebugging_connect_networklocations.js]
 [browser_aboutdebugging_connect_toggle_usb_devices.js]
 skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
 [browser_aboutdebugging_connection_prompt_setting.js]
 [browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js]
 [browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js]
 [browser_aboutdebugging_debug-target-pane_empty.js]
 [browser_aboutdebugging_debug-target-pane_usb_runtime.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/* import-globals-from helper-addons.js */
+Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this);
+
+// Test that extension warnings are displayed in about:debugging.
+add_task(async function() {
+  const EXTENSION_NAME = "Temporary web extension";
+  const EXTENSION_ID = "test-devtools@mozilla.org";
+
+  const { document, tab } = await openAboutDebugging();
+
+  const manifest = {
+    "manifest_version": 2,
+    "name": EXTENSION_NAME,
+    "version": "1.0",
+    "applications": {
+      "gecko": {
+        "id": EXTENSION_ID,
+      },
+    },
+    // This property is not expected in the manifest and should trigger a warning!
+    "wrongProperty": {},
+  };
+
+  const tempExt = new TemporaryExtension(EXTENSION_ID);
+  tempExt.writeManifest(manifest);
+  registerCleanupFunction(() => tempExt.remove());
+
+  info("Install a temporary extension");
+  await AddonManager.installTemporaryAddon(tempExt.sourceDir);
+
+  info("Wait until a debug target item appears");
+  await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document));
+  const target = findDebugTargetByText(EXTENSION_NAME, document);
+
+  const warningMessage = target.querySelector(".js-message");
+  ok(!!warningMessage, "A warning message is displayed for the installed addon");
+
+  const warningText = warningMessage.textContent;
+  ok(warningText.includes("wrongProperty"), "The warning message mentions wrongProperty");
+
+  await removeTemporaryExtension(EXTENSION_NAME, document);
+  await removeTab(tab);
+});