Bug 1313767: Deobfuscate events/core.js r=rpl
MozReview-Commit-ID: Ktj70L3DcQF
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user