fune/browser/base/content/test/general/browser_bug495058.js
Mike Conley 4cfba25655 Bug 1261842 - Update browser_bug495058.js to account for the initial browser being remote. r=Gijs
MozReview-Commit-ID: 6Ktl6Dyztg3

--HG--
extra : rebase_source : 5e7cb7e38189d71a6f185d26881acb4477ece35d
extra : source : b6f7395d2bbff04ba48419d30ebecf848771e9fc
2016-05-25 15:57:57 -04:00

38 lines
1.3 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(function*() {
for (let uri of URIS) {
let tab = gBrowser.addTab();
yield BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
let win = gBrowser.replaceTabWithWindow(tab);
yield TestUtils.topicObserved("browser-delayed-startup-finished",
subject => subject == win);
tab = win.gBrowser.selectedTab;
// BrowserTestUtils doesn't get the add-on shims, which means that
// MozAfterPaint won't get shimmed over if we add an event handler
// for it in the parent.
if (tab.linkedBrowser.isRemoteBrowser) {
yield BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "MozAfterPaint");
} else {
yield BrowserTestUtils.waitForEvent(tab.linkedBrowser, "MozAfterPaint");
}
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");
yield BrowserTestUtils.closeWindow(win);
}
});