mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 985042 - DataStore.jsm removes its inner-window-destroyed observer. r=ehsan
This commit is contained in:
parent
1c1cd1a7e6
commit
5b968690f1
@ -68,7 +68,8 @@ this.DataStore.prototype = {
|
||||
classDescription: "DataStore XPCOM Component",
|
||||
classID: Components.ID("{db5c9602-030f-4bff-a3de-881a8de370f2}"),
|
||||
contractID: "@mozilla.org/dom/datastore;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports,
|
||||
Components.interfaces.nsIObserver]),
|
||||
|
||||
callbacks: [],
|
||||
|
||||
@ -92,16 +93,7 @@ this.DataStore.prototype = {
|
||||
this._db = new DataStoreDB();
|
||||
this._db.init(aOwner, aName);
|
||||
|
||||
let self = this;
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
|
||||
if (wId == self._innerWindowID) {
|
||||
cpmm.removeMessageListener("DataStore:Changed:Return:OK", self);
|
||||
cpmm.sendAsyncMessage("DataStore:UnregisterForMessages");
|
||||
self._shuttingdown = true;
|
||||
self._db.close();
|
||||
}
|
||||
}, "inner-window-destroyed", false);
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
|
||||
let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
@ -112,6 +104,18 @@ this.DataStore.prototype = {
|
||||
{ store: this._name, owner: this._owner });
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
|
||||
if (wId == this._innerWindowID) {
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
|
||||
cpmm.removeMessageListener("DataStore:Changed:Return:OK", this);
|
||||
cpmm.sendAsyncMessage("DataStore:UnregisterForMessages");
|
||||
this._shuttingdown = true;
|
||||
this._db.close();
|
||||
}
|
||||
},
|
||||
|
||||
newDBPromise: function(aTxnType, aFunction) {
|
||||
let self = this;
|
||||
return new this._window.Promise(function(aResolve, aReject) {
|
||||
|
Loading…
Reference in New Issue
Block a user