зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1442465 - Part 2: Use BrowserTestUtils.{waitForTabClosing,waitForSessionStoreUpdate} instead of BrowserTestUtils.tabRemoved. r=dao
This commit is contained in:
Родитель
20da8976aa
Коммит
3038c58523
|
@ -64,11 +64,11 @@ add_task(async function checkCaptivePortalCertErrorUI() {
|
|||
let portalTab2 = await portalTabPromise;
|
||||
is(portalTab2, portalTab, "The existing portal tab should be focused.");
|
||||
|
||||
let portalTabRemoved = BrowserTestUtils.tabRemoved(portalTab);
|
||||
let portalTabClosing = BrowserTestUtils.waitForTabClosing(portalTab);
|
||||
let errorTabReloaded = BrowserTestUtils.waitForErrorPage(browser);
|
||||
|
||||
Services.obs.notifyObservers(null, "captive-portal-login-success");
|
||||
await portalTabRemoved;
|
||||
await portalTabClosing;
|
||||
|
||||
info("Waiting for error tab to be reloaded after the captive portal was freed.");
|
||||
await errorTabReloaded;
|
||||
|
|
|
@ -7,9 +7,7 @@ add_task(async function() {
|
|||
var tab = gBrowser.selectedTab;
|
||||
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
|
||||
|
||||
let tabClosedPromise = BrowserTestUtils.tabRemoved(tab);
|
||||
EventUtils.synthesizeKey("w", { accelKey: true });
|
||||
await tabClosedPromise;
|
||||
|
||||
is(tab.parentNode, null, "ctrl+w removes the tab");
|
||||
is(gBrowser.tabs.length, 1, "a new tab has been opened");
|
||||
|
|
|
@ -32,12 +32,9 @@ add_task(async function() {
|
|||
await secondTabLoadedPromise;
|
||||
|
||||
let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
|
||||
let closePromise = BrowserTestUtils.tabRemoved(secondTab);
|
||||
info("closing second tab (which will self-close in beforeunload)");
|
||||
closeBtn.click();
|
||||
ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
|
||||
await closePromise;
|
||||
ok(secondTab.closing, "Second tab should still be marked as closing");
|
||||
ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
|
||||
ok(!firstTab.closing, "First tab should not be closing");
|
||||
ok(firstTab.linkedBrowser, "First tab's browser should be alive");
|
||||
|
|
|
@ -17,7 +17,7 @@ add_task(async function test_without_dump() {
|
|||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
await BrowserTestUtils.crashBrowser(browser);
|
||||
|
||||
let tabRemovedPromise = BrowserTestUtils.tabRemoved(tab);
|
||||
let tabClosingPromise = BrowserTestUtils.waitForTabClosing(tab);
|
||||
|
||||
await ContentTask.spawn(browser, null, async function() {
|
||||
let doc = content.document;
|
||||
|
@ -31,6 +31,6 @@ add_task(async function test_without_dump() {
|
|||
doc.getElementById("closeTab").click();
|
||||
});
|
||||
|
||||
await tabRemovedPromise;
|
||||
await tabClosingPromise;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -66,7 +66,7 @@ async function runTest(aSourceWindow, aDestWindow, aExpectSwitch, aCallback) {
|
|||
|
||||
let awaitTabSwitch;
|
||||
if (aExpectSwitch) {
|
||||
awaitTabSwitch = BrowserTestUtils.tabRemoved(testTab);
|
||||
awaitTabSwitch = BrowserTestUtils.waitForTabClosing(testTab);
|
||||
}
|
||||
|
||||
// Execute the selected action.
|
||||
|
|
|
@ -536,11 +536,15 @@ Tester.prototype = {
|
|||
if (this.currentTest && window.gBrowser && gBrowser.tabs.length > 1) {
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
let lastTab = gBrowser.tabContainer.lastChild;
|
||||
if (!lastTab.closing) {
|
||||
// Report the stale tab as an error only when they're not closing.
|
||||
// Tests can finish without waiting for the closing tabs.
|
||||
this.currentTest.addResult(new testResult({
|
||||
name: baseMsg.replace("{elt}", "tab") + ": " +
|
||||
lastTab.linkedBrowser.currentURI.spec,
|
||||
allowFailure: this.currentTest.allowFailure,
|
||||
}));
|
||||
}
|
||||
gBrowser.removeTab(lastTab);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ async function testNewTab(browser) {
|
|||
let targetURL = browser.currentURI.spec;
|
||||
let dialogAppeared = promiseHelperAppDialog();
|
||||
let tabOpened = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen").then((event) => {
|
||||
return [ event.target, BrowserTestUtils.tabRemoved(event.target) ];
|
||||
return [ event.target, BrowserTestUtils.waitForTabClosing(event.target) ];
|
||||
});
|
||||
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter("#target_blank", {}, browser);
|
||||
|
@ -72,8 +72,8 @@ async function testNewTab(browser) {
|
|||
let windowContext = await dialogAppeared;
|
||||
is(windowContext.gBrowser.selectedBrowser.currentURI.spec, targetURL,
|
||||
"got the right windowContext");
|
||||
let [ tab, closed ] = await tabOpened;
|
||||
await closed;
|
||||
let [ tab, closingPromise ] = await tabOpened;
|
||||
await closingPromise;
|
||||
is(tab.linkedBrowser, null, "tab was opened and closed");
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче