1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 09:42:28 +01:00

Add util.weakReference that won't crash if you pass null.

This commit is contained in:
Kris Maglione
2011-10-01 23:02:00 -04:00
parent c9583ac72f
commit 84a68bff9a
12 changed files with 25 additions and 15 deletions

View File

@@ -205,7 +205,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
registerObserver: function registerObserver(type, callback, weak) {
if (!(type in this._observers))
this._observers[type] = [];
this._observers[type].push(weak ? Cu.getWeakReference(callback) : { get: function () callback });
this._observers[type].push(weak ? util.weakReference(callback) : { get: function () callback });
},
registerObservers: function registerObservers(obj, prop) {