mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 1065128 - Make SettingsManager use dom-window-destroyed for shutdown; r=bent
This commit is contained in:
parent
8b1a9d6efe
commit
10c38bbb14
@ -359,16 +359,15 @@ SettingsManager.prototype = {
|
||||
cpmm.addMessageListener("Settings:Change:Return:OK", this);
|
||||
this._window = aWindow;
|
||||
this._principal = this._window.document.nodePrincipal;
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
Services.obs.addObserver(this, "dom-window-destroyed", false);
|
||||
let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
this.innerWindowID = util.currentInnerWindowID;
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "inner-window-destroyed") {
|
||||
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
|
||||
if (wId == this.innerWindowID) {
|
||||
if (DEBUG) debug("Topic: " + aTopic);
|
||||
if (aTopic == "dom-window-destroyed") {
|
||||
let window = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
if (window == this._window) {
|
||||
this.cleanup();
|
||||
}
|
||||
}
|
||||
@ -399,7 +398,7 @@ SettingsManager.prototype = {
|
||||
},
|
||||
|
||||
cleanup: function() {
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
Services.obs.removeObserver(this, "dom-window-destroyed");
|
||||
cpmm.removeMessageListener("Settings:Change:Return:OK", this);
|
||||
mrm.unregisterStrongReporter(this);
|
||||
// At this point, the window is dying, so there's nothing left
|
||||
|
Loading…
Reference in New Issue
Block a user