Backed out changeset ba253783b432 (bug 1335801) for browser_referrer_simple_click.js failures a=backout CLOSED TREE

MozReview-Commit-ID: 5jn0Okch3jt

--HG--
extra : amend_source : 509a1aa488b347029a7aea4526380366d5f4af2d
This commit is contained in:
Wes Kocher 2017-03-06 15:30:03 -08:00
Родитель ae5ce5bbed
Коммит d1b8197b88
5 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -6,7 +6,7 @@ function startNewPrivateWindowTestCase(aTestNumber) {
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
newWindowOpened().then(function(aNewWindow) {
BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
someTabLoaded(aNewWindow).then(function() {
checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
startNewPrivateWindowTestCase);
});

Просмотреть файл

@ -6,7 +6,7 @@ function startNewWindowTestCase(aTestNumber) {
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
newWindowOpened().then(function(aNewWindow) {
BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
someTabLoaded(aNewWindow).then(function() {
checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
startNewWindowTestCase);
});

Просмотреть файл

@ -9,7 +9,7 @@ function startNewWindowTestCase(aTestNumber) {
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
newWindowOpened().then(function(aNewWindow) {
BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
someTabLoaded(aNewWindow).then(function() {
checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
startNewWindowTestCase,
{ userContextId: 1 });

Просмотреть файл

@ -140,8 +140,18 @@ function delayedStartupFinished(aWindow) {
* @resolves With the tab once it's loaded.
*/
function someTabLoaded(aWindow) {
return BrowserTestUtils.waitForNewTab(gTestWindow.gBrowser).then((tab) => {
return BrowserTestUtils.browserStopped(tab.linkedBrowser).then(() => tab);
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);
});
}
@ -199,7 +209,7 @@ function referrerTestCaseLoaded(aTestNumber, aParams) {
let browser = gTestWindow.gBrowser;
return BrowserTestUtils.openNewForegroundTab(browser, () => {
browser.selectedTab = browser.addTab(url, aParams);
}, false, true);
});
}
/**

Просмотреть файл

@ -226,12 +226,11 @@ this.BrowserTestUtils = {
* @return {Promise}
* @resolves Once the selected browser fires its load event.
*/
firstBrowserLoaded(win, aboutBlank = true) {
firstBrowserLoaded(win) {
let mm = win.messageManager;
return this.waitForMessage(mm, "browser-test-utils:loadEvent", (msg) => {
let selectedBrowser = win.gBrowser.selectedBrowser;
return msg.target == selectedBrowser &&
(aboutBlank || selectedBrowser.currentURI.spec != "about:blank")
return msg.target == selectedBrowser;
});
},