Bug 513420 - random failure in browser_privatebrowsing_windowtitle.js, r=mconnor. Further modified by me, r=ehsan

This commit is contained in:
Ehsan Akhgari 2009-10-09 23:13:53 +02:00
Родитель 055c90d0fd
Коммит 91971fd031
1 изменённых файлов: 34 добавлений и 25 удалений

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

@ -80,35 +80,44 @@ function test() {
let tab = gBrowser.selectedTab = gBrowser.addTab(); let tab = gBrowser.selectedTab = gBrowser.addTab();
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function() { // ensure that the test is run after the titlebar has been updated
browser.removeEventListener("load", arguments.callee, true); let timer = null;
let _updateTitlebar = gBrowser.updateTitlebar;
gBrowser.updateTitlebar = function() {
if (timer) {
timer.cancel();
timer = null;
}
timer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
timer.initWithCallback(function () {
_updateTitlebar.apply(gBrowser, arguments);
gBrowser.updateTitlebar = _updateTitlebar;
is(document.title, expected_title, "The window title for " + url +
" is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)");
// ensure that the test is run after the page onload event let win = gBrowser.replaceTabWithWindow(tab);
setTimeout(function() { win.addEventListener("load", function() {
setTimeout(function() { win.removeEventListener("load", arguments.callee, false);
is(document.title, expected_title, "The window title for " + url +
" is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)");
let win = gBrowser.replaceTabWithWindow(tab); // ensure that the test is run after delayedStartup
win.addEventListener("load", function() { let _delayedStartup = win.delayedStartup;
win.removeEventListener("load", arguments.callee, false); win.delayedStartup = function() {
_delayedStartup.apply(win, arguments);
win.delayedStartup = _delayedStartup;
// ensure that the test is run after delayedStartup is(win.document.title, expected_title, "The window title for " + url +
setTimeout(function() { " detached tab is correct (" + (insidePB ? "inside" : "outside") +
setTimeout(function() { " private browsing mode)");
is(win.document.title, expected_title, "The window title for " + url + win.close();
" detahced tab is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)"); setTimeout(funcNext, 0);
win.close(); };
}, false);
}, 300, Ci.nsITimer.TYPE_ONE_SHOT);
};
funcNext();
}, 0);
}, 0);
}, false);
}, 0);
}, 0);
}, true);
browser.loadURI(url); browser.loadURI(url);
} }