gecko-dev/browser/base/content/test/general/browser_bug495058.js
Razvan Maries 10425eddfc Backed out 7 changesets (bug 1658084, bug 1671983) for perma failures on browser_async_remove_tab.js and browser_e10s_chrome_process.js. CLOSED TREE
Backed out changeset 2e6309c1cdbd (bug 1658084)
Backed out changeset 99aafd9304ef (bug 1671983)
Backed out changeset 80280b85280a (bug 1671983)
Backed out changeset 008db2659002 (bug 1671983)
Backed out changeset 32bd45c7fe3a (bug 1671983)
Backed out changeset 56e227e6580c (bug 1671983)
Backed out changeset a404f809f79d (bug 1671983)
2020-11-04 04:23:47 +02:00

47 lines
1.4 KiB
JavaScript

/**
* Tests that the right elements of a tab are focused when it is
* torn out into its own window.
*/
const URIS = ["about:blank", "about:sessionrestore", "about:privatebrowsing"];
add_task(async function() {
for (let uri of URIS) {
let tab = BrowserTestUtils.addTab(gBrowser);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
let win = gBrowser.replaceTabWithWindow(tab);
let contentPainted = Promise.resolve();
// In the e10s case, we wait for the content to first paint before we focus
// the URL in the new window, to optimize for content paint time.
if (tab.linkedBrowser.isRemoteBrowser) {
contentPainted = BrowserTestUtils.waitForContentEvent(
tab.linkedBrowser,
"MozAfterPaint"
);
}
await TestUtils.topicObserved(
"browser-delayed-startup-finished",
subject => subject == win
);
await contentPainted;
tab = win.gBrowser.selectedTab;
Assert.equal(
win.gBrowser.currentURI.spec,
uri,
uri + ": uri loaded in detached tab"
);
Assert.equal(
win.document.activeElement,
win.gBrowser.selectedBrowser,
uri + ": browser is focused"
);
Assert.equal(win.gURLBar.value, "", uri + ": urlbar is empty");
Assert.ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
await BrowserTestUtils.closeWindow(win);
}
});