summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDomenic Denicola <d@domenic.me>2015-05-22 19:41:28 -0400
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:11 -0700
commit659dadd410a2a0851dd16ca6f8f5e3103bfaf7da (patch)
treebdc823ac26a90943d752763f113022823276b27e /test
parent944f68046c028484f3f5e741d63f85d65e08090c (diff)
downloadandroid-node-v8-659dadd410a2a0851dd16ca6f8f5e3103bfaf7da.tar.gz
android-node-v8-659dadd410a2a0851dd16ca6f8f5e3103bfaf7da.tar.bz2
android-node-v8-659dadd410a2a0851dd16ca6f8f5e3103bfaf7da.zip
vm: fix property descriptors of sandbox properties
The GlobalPropertyQueryCallback was changed in 2010 to return an integer instead of a boolean: https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU This integer communicates the property descriptors of the property, instead of just its presence or absence. However, the original contextify code was probably written before this change, and it was not updated when porting to Node.js. Credit to @smikes for the test and the original PR of #885. Fixes: https://github.com/nodejs/io.js/pull/864 Fixes: https://github.com/nodejs/io.js/pull/885 PR-URL: https://github.com/nodejs/io.js/pull/1773 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-vm-preserves-property.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/parallel/test-vm-preserves-property.js b/test/parallel/test-vm-preserves-property.js
new file mode 100644
index 0000000000..85ce2d6e81
--- /dev/null
+++ b/test/parallel/test-vm-preserves-property.js
@@ -0,0 +1,25 @@
+'use strict';
+
+var common = require('../common');
+var assert = require('assert');
+
+var vm = require('vm');
+
+var x = {};
+Object.defineProperty(x, 'prop', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: 'val'
+});
+var o = vm.createContext(x);
+
+var code = 'Object.getOwnPropertyDescriptor(this, "prop")';
+var res = vm.runInContext(code, o, 'test');
+
+assert(res);
+assert.equal(typeof res, 'object');
+assert.equal(res.value, 'val');
+assert.equal(res.configurable, false, 'should not be configurable');
+assert.equal(res.enumerable, false, 'should not be enumerable');
+assert.equal(res.writable, false, 'should not be writable');