Private symbol key is now non-enumerable
This will, at least in ES5 environments, prevent its general discovery and [accidental] use. Of course, any decent debugger will still be able to see it, so unless ES6 is used, this is not truely hidden.protolib
parent
072fef2dc0
commit
031489a07b
|
@ -822,7 +822,7 @@ exports.prototype.createCtor = function( cname, abstract_methods, members )
|
||||||
new_class = this.createAbstractCtor( cname );
|
new_class = this.createAbstractCtor( cname );
|
||||||
}
|
}
|
||||||
|
|
||||||
new_class[ _priv ] = {};
|
util.defineSecureProp( new_class, _priv, {} );
|
||||||
return new_class;
|
return new_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,7 +1314,7 @@ function initInstance( instance )
|
||||||
|
|
||||||
// initialize our *own* private metadata store; do not use the
|
// initialize our *own* private metadata store; do not use the
|
||||||
// prototype's
|
// prototype's
|
||||||
instance[ _priv ] = {};
|
util.defineSecureProp( instance, _priv, {} );
|
||||||
|
|
||||||
// add the visibility objects to the data object for this class instance
|
// add the visibility objects to the data object for this class instance
|
||||||
instance[ _priv ].vis = new prot();
|
instance[ _priv ].vis = new prot();
|
||||||
|
|
Loading…
Reference in New Issue