1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-13 10:25:46 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-30 22:31:04 -08:00
parent da3785028d
commit 2274b0900a
14 changed files with 51 additions and 46 deletions

View File

@@ -157,9 +157,20 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
getData: function getData(obj, key, constructor) {
if (!this.weakMap.has(obj))
this.weakMap.set(obj, {});
try {
this.weakMap.set(obj, {});
}
catch (e if e instanceof TypeError) {
// util.dump("Bad WeakMap key: " + obj + " " + Components.stack.caller);
let { id } = this;
let data = this.weakMap.get(obj);
if (!(id in obj && obj[id]))
obj[id] = {};
var data = obj[id];
}
data = data || this.weakMap.get(obj);
if (arguments.length == 1)
return data;