зеркало из https://github.com/mozilla/gecko-dev.git
Bug 908878 - Fix for intermittent browser_webconsole_bug_595350_multiple_windows_and_tabs.js | Timed out while waiting for: 4 web consoles {opened|closed}; r=me
This commit is contained in:
Родитель
398297135d
Коммит
60355fdf96
|
@ -19,7 +19,7 @@ let openTabs = [];
|
|||
let loadedTabCount = 0;
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(2);
|
||||
requestLongerTimeout(3);
|
||||
|
||||
// Add two tabs in the main window.
|
||||
addTabs(win1);
|
||||
|
@ -45,6 +45,7 @@ function addTabs(aWindow) {
|
|||
tab.linkedBrowser.removeEventListener(aEvent.type, onLoad, true);
|
||||
|
||||
loadedTabCount++;
|
||||
info("tabs loaded: " + loadedTabCount);
|
||||
if (loadedTabCount >= 4) {
|
||||
executeSoon(openConsoles);
|
||||
}
|
||||
|
@ -62,19 +63,12 @@ function openConsoles() {
|
|||
let window = hud.target.tab.linkedBrowser.contentWindow;
|
||||
window.console.log("message for tab " + index);
|
||||
consolesOpen++;
|
||||
if (consolesOpen == 4) {
|
||||
// Use executeSoon() to allow the promise to resolve.
|
||||
executeSoon(closeConsoles);
|
||||
}
|
||||
}.bind(null, i));
|
||||
}
|
||||
|
||||
waitForSuccess({
|
||||
timeout: 15000,
|
||||
name: "4 web consoles opened",
|
||||
validatorFn: function()
|
||||
{
|
||||
return consolesOpen == 4;
|
||||
},
|
||||
successFn: closeConsoles,
|
||||
failureFn: closeConsoles,
|
||||
});
|
||||
}
|
||||
|
||||
function closeConsoles() {
|
||||
|
@ -83,32 +77,25 @@ function closeConsoles() {
|
|||
function onWebConsoleClose(aSubject, aTopic) {
|
||||
if (aTopic == "web-console-destroyed") {
|
||||
consolesClosed++;
|
||||
info("consoles destroyed: " + consolesClosed);
|
||||
if (consolesClosed == 4) {
|
||||
// Use executeSoon() to allow all the observers to execute.
|
||||
executeSoon(finishTest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Services.obs.addObserver(onWebConsoleClose, "web-console-destroyed", false);
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.obs.removeObserver(onWebConsoleClose, "web-console-destroyed");
|
||||
});
|
||||
|
||||
win2.close();
|
||||
|
||||
win1.gBrowser.removeTab(openTabs[0]);
|
||||
win1.gBrowser.removeTab(openTabs[1]);
|
||||
|
||||
openTabs = win1 = win2 = null;
|
||||
|
||||
function onTimeout() {
|
||||
Services.obs.removeObserver(onWebConsoleClose, "web-console-destroyed");
|
||||
executeSoon(finishTest);
|
||||
}
|
||||
|
||||
waitForSuccess({
|
||||
timeout: 10000,
|
||||
name: "4 web consoles closed",
|
||||
validatorFn: function()
|
||||
{
|
||||
return consolesClosed == 4;
|
||||
},
|
||||
successFn: onTimeout,
|
||||
failureFn: onTimeout,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче