fune/docshell/test/navigation/browser_test-content-chromeflags.js
Toby Ward 75e6200c17 Bug 1496082: Enable ESLint for docshell/test/navigation and docshell/test/unit (automatic fixes only). r=bzbarsky
Enabled ESLint for:

* docshell/test/navigation/**
* docshell/test/unit/**
* docshell/test/unit_ipc/**

Changed .eslintignore to allow for this and ran ./mach eslint --fix on the above directories and checked automatic fixes

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

--HG--
extra : moz-landing-system : lando
2018-11-07 13:55:47 +00:00

43 lines
1.4 KiB
JavaScript

const TEST_PAGE = `data:text/html,<html><body><a href="about:blank" target="_blank">Test</a></body></html>`;
const CHROME_ALL = Ci.nsIWebBrowserChrome.CHROME_ALL;
const CHROME_REMOTE_WINDOW = Ci.nsIWebBrowserChrome.CHROME_REMOTE_WINDOW;
/**
* Tests that when we open new browser windows from content they
* get the full browser chrome.
*/
add_task(async function() {
// Make sure that the window.open call will open a new
// window instead of a new tab.
await new Promise(resolve => {
SpecialPowers.pushPrefEnv({
"set": [
["browser.link.open_newwindow", 2],
],
}, resolve);
});
await BrowserTestUtils.withNewTab({
gBrowser,
url: TEST_PAGE,
}, async function(browser) {
let openedPromise = BrowserTestUtils.waitForNewWindow();
BrowserTestUtils.synthesizeMouse("a", 0, 0, {}, browser);
let win = await openedPromise;
let chromeFlags = win.docShell
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow)
.chromeFlags;
// In the multi-process case, the new window will have the
// CHROME_REMOTE_WINDOW flag set.
const EXPECTED = gMultiProcessBrowser ? CHROME_ALL | CHROME_REMOTE_WINDOW
: CHROME_ALL;
is(chromeFlags, EXPECTED, "Window should have opened with all chrome");
BrowserTestUtils.closeWindow(win);
});
});