Bug 658738 - observe browser-delayed-startup-finished instead of replacing delayedStartup

This commit is contained in:
Dão Gottwald 2011-06-27 07:49:03 +02:00
parent 4004fc4ed4
commit ccf200872f

View File

@ -26,25 +26,22 @@ function next() {
function detach() {
var win = gBrowser.replaceTabWithWindow(tab);
win.addEventListener("load", function () {
win.removeEventListener("load", arguments.callee, false);
var _delayedStartup = win.delayedStartup;
win.delayedStartup = function delayedStartup() {
_delayedStartup.apply(win, arguments);
win.delayedStartup = _delayedStartup;
Services.obs.addObserver(function (subject, topic, data) {
if (subject != win)
return;
Services.obs.removeObserver(arguments.callee, topic);
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
is(win.gURLBar.value, "", uri + ": urlbar is empty");
ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
is(win.gURLBar.value, "", uri + ": urlbar is empty");
ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
win.close();
if (uris.length)
next();
else
executeSoon(finish);
};
}, false);
win.close();
if (uris.length)
next();
else
executeSoon(finish);
}, "browser-delayed-startup-finished", false);
}
}