зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1220929 - Harden browser_crashedTabs.js against races. r=felipe
--HG-- extra : commitid : FSJSywuhoKC extra : rebase_source : 51a76681e6d89e64927955e7aa01eb703bef8c12
This commit is contained in:
Родитель
c70576a28d
Коммит
d9dd7d1040
|
@ -101,6 +101,23 @@ function promiseHistoryLength(browser, length) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Promise that resolves when a browser has fired the
|
||||
* AboutTabCrashedReady event.
|
||||
*
|
||||
* @param browser
|
||||
* The remote <xul:browser> that will fire the event.
|
||||
* @return Promise
|
||||
*/
|
||||
function promiseTabCrashedReady(browser) {
|
||||
return new Promise((resolve) => {
|
||||
browser.addEventListener("AboutTabCrashedReady", function ready(e) {
|
||||
browser.removeEventListener("AboutTabCrashedReady", ready, false, true);
|
||||
resolve();
|
||||
}, false, true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that if a tab crashes, that information about the tab crashed
|
||||
* page does not get added to the tab history.
|
||||
|
@ -374,8 +391,13 @@ add_task(function* test_hide_restore_all_button() {
|
|||
browser.loadURI(PAGE_2);
|
||||
yield promiseBrowserLoaded(browser);
|
||||
|
||||
// We'll need to make sure the second tab's browser has finished
|
||||
// sending its AboutTabCrashedReady event before we know for
|
||||
// sure whether or not we're showing the right Restore buttons.
|
||||
let otherBrowserReady = promiseTabCrashedReady(newTab2.linkedBrowser);
|
||||
// Crash the tab
|
||||
yield BrowserTestUtils.crashBrowser(browser);
|
||||
yield otherBrowserReady;
|
||||
|
||||
doc = browser.contentDocument;
|
||||
restoreAllButton = doc.getElementById("restoreAll");
|
||||
|
|
Загрузка…
Ссылка в новой задаче