fune/docshell/test/navigation/browser_test-content-chromeflags.js
Dorel Luca 0207ce5451 Backed out 2 changesets (bug 1470510) for build bustage on /build/src/widget/cocoa/nsChildView.mm. CLOSED TREE
Backed out changeset 5967bf633574 (bug 1470510)
Backed out changeset 067a556bb614 (bug 1470510)

--HG--
rename : xpfe/appshell/nsIAppWindow.idl => xpfe/appshell/nsIXULWindow.idl
rename : xpfe/appshell/AppWindow.cpp => xpfe/appshell/nsXULWindow.cpp
rename : xpfe/appshell/AppWindow.h => xpfe/appshell/nsXULWindow.h
extra : amend_source : 752d828c6a0726c3f2df57a25741e38b36b75d6b
2019-11-04 19:18:56 +02:00

57 lines
1.6 KiB
JavaScript

const TEST_PAGE = `data:text/html,<html><body><a href="about:blank" target="_blank">Test</a></body></html>`;
const {
CHROME_ALL,
CHROME_REMOTE_WINDOW,
CHROME_FISSION_WINDOW,
} = Ci.nsIWebBrowserChrome;
/**
* 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;
let expected = CHROME_ALL;
// In the multi-process tab case, the new window will have the
// CHROME_REMOTE_WINDOW flag set.
if (gMultiProcessBrowser) {
expected |= CHROME_REMOTE_WINDOW;
}
// In the multi-process subframe case, the new window will have the
// CHROME_FISSION_WINDOW flag set.
if (gFissionBrowser) {
expected |= CHROME_FISSION_WINDOW;
}
is(chromeFlags, expected, "Window should have opened with all chrome");
await BrowserTestUtils.closeWindow(win);
}
);
});