зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 881468 - Event listener not properly removed in BrowserTabList. r=jimb
Fix bug 881468 - Event listener not properly removed in BrowserTabList. r=jimb
This commit is contained in:
Родитель
801bd00711
Коммит
6f9fcadd39
|
@ -378,17 +378,7 @@ BrowserTabList.prototype._listenToMediatorIf = function(aShouldListen) {
|
|||
BrowserTabList.prototype.onWindowTitleChange = () => { };
|
||||
|
||||
BrowserTabList.prototype.onOpenWindow = makeInfallible(function(aWindow) {
|
||||
/*
|
||||
* You can hardly do anything at all with a XUL window at this point; it
|
||||
* doesn't even have its document yet. Wait until its document has
|
||||
* loaded, and then see what we've got. This also avoids
|
||||
* nsIWindowMediator enumeration from within listeners (bug 873589).
|
||||
*/
|
||||
aWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindow);
|
||||
aWindow.addEventListener("load", makeInfallible(handleLoad.bind(this)), false);
|
||||
|
||||
function handleLoad(aEvent) {
|
||||
let handleLoad = makeInfallible(() => {
|
||||
/* We don't want any further load events from this window. */
|
||||
aWindow.removeEventListener("load", handleLoad, false);
|
||||
|
||||
|
@ -408,7 +398,18 @@ BrowserTabList.prototype.onOpenWindow = makeInfallible(function(aWindow) {
|
|||
// document's initial tab, so we must notify our client of the new tab
|
||||
// this will have.
|
||||
this._notifyListChanged();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* You can hardly do anything at all with a XUL window at this point; it
|
||||
* doesn't even have its document yet. Wait until its document has
|
||||
* loaded, and then see what we've got. This also avoids
|
||||
* nsIWindowMediator enumeration from within listeners (bug 873589).
|
||||
*/
|
||||
aWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindow);
|
||||
|
||||
aWindow.addEventListener("load", handleLoad, false);
|
||||
}, "BrowserTabList.prototype.onOpenWindow");
|
||||
|
||||
BrowserTabList.prototype.onCloseWindow = makeInfallible(function(aWindow) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче