1
0
Fork 0

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
Mike Gerwitz 2014-07-07 22:04:50 -04:00
parent 072fef2dc0
commit 031489a07b
1 changed files with 2 additions and 2 deletions

View File

@ -822,7 +822,7 @@ exports.prototype.createCtor = function( cname, abstract_methods, members )
new_class = this.createAbstractCtor( cname );
}
new_class[ _priv ] = {};
util.defineSecureProp( new_class, _priv, {} );
return new_class;
}
@ -1314,7 +1314,7 @@ function initInstance( instance )
// initialize our *own* private metadata store; do not use the
// prototype's
instance[ _priv ] = {};
util.defineSecureProp( instance, _priv, {} );
// add the visibility objects to the data object for this class instance
instance[ _priv ].vis = new prot();