diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2011-09-08 18:42:44 +0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-09-08 11:59:21 -0700 |
commit | 4527de8cba3bf5f107fcefcf43dbdaa308881ba4 (patch) | |
tree | 44219bcf76fb3786c79f973c9c1d3fdf7612e771 /lib/vm.js | |
parent | bb3a1d5b675511fdd287009e01430fc96f286cd0 (diff) | |
download | android-node-v8-4527de8cba3bf5f107fcefcf43dbdaa308881ba4.tar.gz android-node-v8-4527de8cba3bf5f107fcefcf43dbdaa308881ba4.tar.bz2 android-node-v8-4527de8cba3bf5f107fcefcf43dbdaa308881ba4.zip |
vm context with accessors
true copy of sandbox properties
catch sealed errors, pass global's prototype to CloneObject
Fixes #1673
Diffstat (limited to 'lib/vm.js')
-rw-r--r-- | lib/vm.js | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -21,6 +21,19 @@ var binding = process.binding('evals'); +binding.NodeScript._setCloneMethod(function(source, target) { + Object.getOwnPropertyNames(source).forEach(function(key) { + try { + var desc = Object.getOwnPropertyDescriptor(source, key); + if (desc.value === source) desc.value = target; + + Object.defineProperty(target, key, desc); + } catch (e) { + // Catch sealed properties errors + } + }); +}); + exports.Script = binding.NodeScript; exports.createScript = function(code, ctx, name) { return new exports.Script(code, ctx, name); |