Bug 1335801 - Wait for the right events. r=Felipe,krizsa
MozReview-Commit-ID: JL0AdE8XB2n
--- a/browser/base/content/test/referrer/head.js
+++ b/browser/base/content/test/referrer/head.js
@@ -135,29 +135,17 @@ function delayedStartupFinished(aWindow)
/**
* Waits for some (any) tab to load. The caller triggers the load.
* @param aWindow The window where to wait for a tab to load.
* @return {Promise}
* @resolves With the tab once it's loaded.
*/
function someTabLoaded(aWindow) {
- return new Promise(function(resolve) {
- aWindow.gBrowser.addEventListener("load", function onLoad(aEvent) {
- if (aWindow.location.href === "about:blank") {
- return;
- }
- let tab = aWindow.gBrowser._getTabForContentWindow(
- aEvent.target.defaultView.top);
- if (tab) {
- aWindow.gBrowser.removeEventListener("load", onLoad, true);
- resolve(tab);
- }
- }, true);
- });
+ return BrowserTestUtils.waitForNewTab(aWindow.gBrowser);
}
/**
* Waits for a new window to open and load. The caller triggers the open.
* @return {Promise}
* @resolves With the new window once it's open and loaded.
*/
function newWindowOpened() {