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 browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function() {
browser.removeEventListener("load", arguments.callee, true);
// ensure that the test is run after the titlebar has been updated
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
setTimeout(function() {
setTimeout(function() {
is(document.title, expected_title, "The window title for " + url +
" is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)");
let win = gBrowser.replaceTabWithWindow(tab);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
let win = gBrowser.replaceTabWithWindow(tab);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
// ensure that the test is run after delayedStartup
let _delayedStartup = win.delayedStartup;
win.delayedStartup = function() {
_delayedStartup.apply(win, arguments);
win.delayedStartup = _delayedStartup;
// ensure that the test is run after delayedStartup
setTimeout(function() {
setTimeout(function() {
is(win.document.title, expected_title, "The window title for " + url +
" detahced tab is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)");
win.close();
is(win.document.title, expected_title, "The window title for " + url +
" detached tab is correct (" + (insidePB ? "inside" : "outside") +
" private browsing mode)");
win.close();
setTimeout(funcNext, 0);
};
}, false);
}, 300, Ci.nsITimer.TYPE_ONE_SHOT);
};
funcNext();
}, 0);
}, 0);
}, false);
}, 0);
}, 0);
}, true);
browser.loadURI(url);
}