Bug 1313767: Deobfuscate events/core.js r=rpl

MozReview-Commit-ID: Ktj70L3DcQF
This commit is contained in:
Kris Maglione
2017-03-25 15:06:25 -07:00
parent 7998a39085
commit ffcc3a3341
5 changed files with 87 additions and 50 deletions

View File

@@ -13,6 +13,40 @@ const { flatten } = require('./array');
const unbind = Function.call.bind(Function.bind, Function.call);
const slice = unbind(Array.prototype.slice);
class DefaultWeakMap extends WeakMap {
constructor(createItem, items = undefined) {
super(items);
this.createItem = createItem;
}
get(key) {
if (!this.has(key)) {
this.set(key, this.createItem(key));
}
return super.get(key);
}
}
class DefaultMap extends Map {
constructor(createItem, items = undefined) {
super(items);
this.createItem = createItem;
}
get(key) {
if (!this.has(key)) {
this.set(key, this.createItem(key));
}
return super.get(key);
}
}
Object.assign(exports, {DefaultMap, DefaultWeakMap});
/**
* Merges all the properties of all arguments into first argument. If two or
* more argument objects have own properties with the same name, the property