Bug 1523706 - Extend devtools test. r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D37912

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Schuster 2019-07-23 09:47:03 +00:00
Родитель 14f3a24095
Коммит 4e4dbeff23
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -6,6 +6,7 @@
// Tests that importScripts loads inside a worker with a non-JavaScript // Tests that importScripts loads inside a worker with a non-JavaScript
// MIME types produce an error and fail. // MIME types produce an error and fail.
// See Bug 1514680. // See Bug 1514680.
// Also tests that `new Worker` with a non-JS MIME type fails. (Bug 1523706)
"use strict"; "use strict";
@ -13,13 +14,21 @@ const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" + "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" + "test/mochitest/" +
"test-non-javascript-mime-worker.html"; "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() { add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI); const hud = await openNewTabAndConsole(TEST_URI);
await waitFor( 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 100
); );

Просмотреть файл

@ -7,6 +7,11 @@
http://creativecommons.org/publicdomain/zero/1.0/ --> http://creativecommons.org/publicdomain/zero/1.0/ -->
<script> <script>
"use strict"; "use strict";
// Test new Worker
new Worker("http://example.com/browser/devtools/client/webconsole/test/mochitest/test-non-javascript-mime.js");
// Test importScripts
const source = `importScripts("http://example.com/browser/devtools/client/webconsole/" + const source = `importScripts("http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/" + "test/mochitest/" +
"test-non-javascript-mime.js");`; "test-non-javascript-mime.js");`;
@ -15,6 +20,6 @@
</script> </script>
</head> </head>
<body> <body>
<p>Web Console test for importScripts() inside Worker with non-JavaScript MIME type.</p> <p>Web Console test for Worker and importScripts() inside Worker with non-JavaScript MIME type.</p>
</body> </body>
</html> </html>