mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 793210 - Make proxy [[GetOwnProperty]] throw appropriately for non-extensible target. (r=jorendorff)
This commit is contained in:
parent
c0d484b966
commit
3006012bbf
@ -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);
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user