Bug 793210 - Make proxy [[GetOwnProperty]] throw appropriately for non-extensible target. (r=jorendorff)

This commit is contained in:
Eric Faust 2014-03-10 15:07:08 -07:00
parent c0d484b966
commit 3006012bbf
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,18 @@
load(libdir + "asserts.js");
var target = {};
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function () {
return {value: 2, configurable: true};
}
}), 'foo');
var target = {};
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function () {
return {value: 2, configurable: true};
}
}), 'foo');
}, TypeError);

View File

@ -1440,7 +1440,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
bool extensible;
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (extensible && !isFixed) {
if (!extensible && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
return false;
}