From 4e4dbeff238c75eb9a99f9af1146d5c258ace5d9 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Tue, 23 Jul 2019 09:47:03 +0000 Subject: [PATCH] Bug 1523706 - Extend devtools test. r=ckerschb Differential Revision: https://phabricator.services.mozilla.com/D37912 --HG-- extra : moz-landing-system : lando --- ...webconsole_non_javascript_mime_worker_error.js | 15 ++++++++++++--- .../test-non-javascript-mime-worker.html | 7 ++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_non_javascript_mime_worker_error.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_non_javascript_mime_worker_error.js index 43e00c4638f9..67cf81704c0b 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_non_javascript_mime_worker_error.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_non_javascript_mime_worker_error.js @@ -6,6 +6,7 @@ // Tests that importScripts loads inside a worker with a non-JavaScript // MIME types produce an error and fail. // See Bug 1514680. +// Also tests that `new Worker` with a non-JS MIME type fails. (Bug 1523706) "use strict"; @@ -13,13 +14,21 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + "test/mochitest/" + "test-non-javascript-mime-worker.html"; -const MIME_ERROR_MSG = - "Loading script from “http://example.com/browser/devtools/client/webconsole/test/mochitest/test-non-javascript-mime.js” with importScripts() was blocked because of a disallowed MIME type (“text/plain”)."; + +const JS_URI = + "http://example.com/browser/devtools/client/webconsole/test/mochitest/test-non-javascript-mime.js"; +const MIME_ERROR_MSG1 = `Loading Worker from “${JS_URI}” was blocked because of a disallowed MIME type (“text/plain”).`; +const MIME_ERROR_MSG2 = `Loading script from “${JS_URI}” with importScripts() was blocked because of a disallowed MIME type (“text/plain”).`; add_task(async function() { const hud = await openNewTabAndConsole(TEST_URI); await waitFor( - () => findMessage(hud, MIME_ERROR_MSG, ".message.error"), + () => findMessage(hud, MIME_ERROR_MSG1, ".message.error"), + "", + 100 + ); + await waitFor( + () => findMessage(hud, MIME_ERROR_MSG2, ".message.error"), "", 100 ); diff --git a/devtools/client/webconsole/test/mochitest/test-non-javascript-mime-worker.html b/devtools/client/webconsole/test/mochitest/test-non-javascript-mime-worker.html index 437a8885d0fb..01a2f22a6c39 100644 --- a/devtools/client/webconsole/test/mochitest/test-non-javascript-mime-worker.html +++ b/devtools/client/webconsole/test/mochitest/test-non-javascript-mime-worker.html @@ -7,6 +7,11 @@ http://creativecommons.org/publicdomain/zero/1.0/ --> -

Web Console test for importScripts() inside Worker with non-JavaScript MIME type.

+

Web Console test for Worker and importScripts() inside Worker with non-JavaScript MIME type.