using v8::Object;
using v8::ObjectTemplate;
using v8::Persistent;
+using v8::PropertyAttribute;
using v8::PropertyCallbackInfo;
using v8::Script;
using v8::ScriptCompiler;
Local<Object> proxy_global = PersistentToLocal(isolate,
ctx->proxy_global_);
- bool in_sandbox = sandbox->GetRealNamedProperty(property).IsEmpty();
- bool in_proxy_global =
- proxy_global->GetRealNamedProperty(property).IsEmpty();
- if (!in_sandbox || !in_proxy_global) {
+ if (sandbox->HasRealNamedProperty(property)) {
+ PropertyAttribute propAttr =
+ sandbox->GetRealNamedPropertyAttributes(property).FromJust();
+ args.GetReturnValue().Set(propAttr);
+ } else if (proxy_global->HasRealNamedProperty(property)) {
+ PropertyAttribute propAttr =
+ proxy_global->GetRealNamedPropertyAttributes(property).FromJust();
+ args.GetReturnValue().Set(propAttr);
+ } else {
args.GetReturnValue().Set(None);
}
}
--- /dev/null
+'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');