From 031489a07be4b56e3d2b9347e8f2112711b5b905 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 7 Jul 2014 22:04:50 -0400 Subject: [PATCH] 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. --- lib/ClassBuilder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ClassBuilder.js b/lib/ClassBuilder.js index 6d94c36..c5c0a4c 100644 --- a/lib/ClassBuilder.js +++ b/lib/ClassBuilder.js @@ -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();