mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
Bug 1051995 - Removed 'mozdocommand' event listener when browser destroyed. r=fabrice
This commit is contained in:
parent
cce12ee77d
commit
272f91b26c
@ -168,11 +168,14 @@ function BrowserElementParent(frameLoader, hasRemoteFrame, isPendingFrame) {
|
|||||||
/* wantsUntrusted = */ false);
|
/* wantsUntrusted = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._doCommandHandlerBinder = this._doCommandHandler.bind(this);
|
||||||
this._frameElement.addEventListener('mozdocommand',
|
this._frameElement.addEventListener('mozdocommand',
|
||||||
this._doCommandHandler.bind(this),
|
this._doCommandHandlerBinder,
|
||||||
/* useCapture = */ false,
|
/* useCapture = */ false,
|
||||||
/* wantsUntrusted = */ false);
|
/* wantsUntrusted = */ false);
|
||||||
|
|
||||||
|
Services.obs.addObserver(this, 'ipc:browser-destroyed', /* ownsWeak = */ true);
|
||||||
|
|
||||||
this._window._browserElementParents.set(this, null);
|
this._window._browserElementParents.set(this, null);
|
||||||
|
|
||||||
// Insert ourself into the prompt service.
|
// Insert ourself into the prompt service.
|
||||||
@ -919,6 +922,13 @@ BrowserElementParent.prototype = {
|
|||||||
}
|
}
|
||||||
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
|
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
|
||||||
}
|
}
|
||||||
|
case 'ipc:browser-destroyed':
|
||||||
|
if (this._isAlive() && subject == this._frameLoader) {
|
||||||
|
Services.obs.removeObserver(this, 'ipc:browser-destroyed');
|
||||||
|
this._frameElement.removeEventListener('mozdocommand',
|
||||||
|
this._doCommandHandlerBinder)
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
debug('Unknown topic: ' + topic);
|
debug('Unknown topic: ' + topic);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user