const gBaseURL = "https://example.com/browser/testing/mochitest/tests/browser/"; function promiseTabLoadEvent(tab, url) { let promise = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url); if (url) { tab.linkedBrowser.loadURI(Services.io.newURI(url)); } return promise; } // Load a new blank tab add_task(async function () { await BrowserTestUtils.openNewForegroundTab(gBrowser); gURLBar.focus(); let browser = gBrowser.selectedBrowser; await SimpleTest.promiseFocus(browser, true); is( document.activeElement, browser, "Browser is focused when about:blank is loaded" ); gBrowser.removeCurrentTab(); gURLBar.focus(); }); add_task(async function () { await BrowserTestUtils.openNewForegroundTab(gBrowser); gURLBar.focus(); let browser = gBrowser.selectedBrowser; // If we're running in e10s, we don't have access to the content // window, so only test window arguments in non-e10s mode. if (browser.contentWindow) { await SimpleTest.promiseFocus(browser.contentWindow, true); is( document.activeElement, browser, "Browser is focused when about:blank is loaded" ); } gBrowser.removeCurrentTab(); gURLBar.focus(); }); // Load a tab with a subframe inside it and wait until the subframe is focused add_task(async function () { let tab = BrowserTestUtils.addTab(gBrowser); gBrowser.selectedTab = tab; let browser = gBrowser.getBrowserForTab(tab); // If we're running in e10s, we don't have access to the content // window, so only test