Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'linux' && os_version == '18.04' && asan OR os == 'linux' && os_version == '18.04' && tsan
- Manifest: browser/components/extensions/test/browser/browser.toml
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// Test that calling window.open from a content script running in a private
add_task(async function test_contentscript_window_open_doesnot_crash() {
const extension = ExtensionTestUtils.loadExtension({
incognitoOverride: "spanning",
manifest: {
content_scripts: [
{
js: ["test_window_open.js"],
},
],
},
files: {
"test_window_open.js": function () {
const newWin = window.open();
browser.test.log("calling window.open did not triggered a crash");
browser.test.sendMessage("window-open-called", !!newWin);
},
},
});
await extension.startup();
const winPrivate = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
await BrowserTestUtils.openNewForegroundTab(
winPrivate.gBrowser,
);
const newWinOpened = await extension.awaitMessage("window-open-called");
ok(newWinOpened, "Content script successfully open a new window");
await extension.unload();
await BrowserTestUtils.closeWindow(winPrivate);
});