fune/dom/tests/browser/browser_noopener_null_uri.js
Kris Maglione 94e3b0bd8d Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.

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

--HG--
extra : moz-landing-system : lando
2019-12-13 20:36:16 +00:00

15 lines
612 B
JavaScript

add_task(async function browserNoopenerNullUri() {
await BrowserTestUtils.withNewTab({ gBrowser }, async function(aBrowser) {
let numTabs = gBrowser.tabs.length;
await SpecialPowers.spawn(aBrowser, [], async () => {
ok(
!content.window.open(undefined, undefined, "noopener"),
"window.open should return null"
);
});
await TestUtils.waitForCondition(() => gBrowser.tabs.length == numTabs + 1);
// We successfully opened a tab in content process!
});
// We only have to close the tab we opened earlier
await BrowserTestUtils.removeTab(gBrowser.tabs[1]);
});