зеркало из https://github.com/mozilla/gecko-dev.git
backing out bug 506471 due to leaks
This commit is contained in:
Родитель
afa866e990
Коммит
b1746c5217
|
@ -103,9 +103,8 @@ EventItem.prototype = {
|
||||||
|
|
||||||
//=================================================
|
//=================================================
|
||||||
// Events constructor
|
// Events constructor
|
||||||
function Events(notifier) {
|
function Events() {
|
||||||
this._listeners = [];
|
this._listeners = [];
|
||||||
this._notifier = notifier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================
|
//=================================================
|
||||||
|
@ -120,10 +119,6 @@ Events.prototype = {
|
||||||
listener: aListener
|
listener: aListener
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this._notifier) {
|
|
||||||
this._notifier(aEvent, aListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasFilter(element) {
|
function hasFilter(element) {
|
||||||
return element.event == aEvent && element.listener == aListener;
|
return element.event == aEvent && element.listener == aListener;
|
||||||
}
|
}
|
||||||
|
@ -570,14 +565,23 @@ extApplication.prototype = {
|
||||||
this._prefs = null;
|
this._prefs = null;
|
||||||
this._extensions = null;
|
this._extensions = null;
|
||||||
this._events = null;
|
this._events = null;
|
||||||
this._registered = {};
|
|
||||||
|
|
||||||
this._info = Components.classes["@mozilla.org/xre/app-info;1"]
|
this._info = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||||
.getService(Ci.nsIXULAppInfo);
|
.getService(Ci.nsIXULAppInfo);
|
||||||
|
|
||||||
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||||
|
.getService(Ci.nsIObserverService);
|
||||||
|
|
||||||
|
os.addObserver(this, "final-ui-startup", false);
|
||||||
|
os.addObserver(this, "quit-application-requested", false);
|
||||||
|
os.addObserver(this, "xpcom-shutdown", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
// get this contractID registered for certain categories via XPCOMUtils
|
// get this contractID registered for certain categories via XPCOMUtils
|
||||||
_xpcom_categories: [
|
_xpcom_categories: [
|
||||||
|
// make Application a startup observer
|
||||||
|
{ category: "app-startup", service: true },
|
||||||
|
|
||||||
// add Application as a global property for easy access
|
// add Application as a global property for easy access
|
||||||
{ category: "JavaScript global privileged property" }
|
{ category: "JavaScript global privileged property" }
|
||||||
],
|
],
|
||||||
|
@ -635,7 +639,6 @@ extApplication.prototype = {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||||
.getService(Ci.nsIObserverService);
|
.getService(Ci.nsIObserverService);
|
||||||
|
|
||||||
os.removeObserver(this, "app-startup");
|
|
||||||
os.removeObserver(this, "final-ui-startup");
|
os.removeObserver(this, "final-ui-startup");
|
||||||
os.removeObserver(this, "quit-application-requested");
|
os.removeObserver(this, "quit-application-requested");
|
||||||
os.removeObserver(this, "xpcom-shutdown");
|
os.removeObserver(this, "xpcom-shutdown");
|
||||||
|
@ -678,23 +681,8 @@ extApplication.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
get events() {
|
get events() {
|
||||||
if (this._events == null) {
|
if (this._events == null)
|
||||||
var self = this;
|
this._events = new Events();
|
||||||
function registerCheck(ev, k) {
|
|
||||||
var rmap = { "load": "app-startup",
|
|
||||||
"ready": "final-ui-startup",
|
|
||||||
"quit": "quit-application-requested",
|
|
||||||
"unload": "xpcom-shutdown" };
|
|
||||||
if (!(ev in rmap) || ev in self._registered)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
|
||||||
.getService(Ci.nsIObserverService).addObserver(self, rmap[ev]);
|
|
||||||
self._registered[ev] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._events = new Events(registerCheck);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._events;
|
return this._events;
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче