Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
// Tests that an uncaught promise rejection from a content script
// is reported to the tabs' webconsole.
"use strict";
const TEST_URI =
"test/browser/test-blank.html";
add_task(async function () {
const extension = ExtensionTestUtils.loadExtension({
manifest: {
content_scripts: [
{
matches: [TEST_URI],
js: ["content-script.js"],
},
],
},
files: {
"content-script.js": function () {
Promise.reject("abc");
},
},
});
await extension.startup();
const hud = await openNewTabAndConsole(TEST_URI);
await waitFor(() => findErrorMessage(hud, "uncaught exception: abc"));
await extension.unload();
});