Bug 978229 - Part 1: Remove IsSealed() from Proxy.[[HasProperty]]. (r=jorendorff)

This commit is contained in:
Eric Faust 2014-04-25 17:10:51 -07:00
Родитель 73f240d1d3
Коммит 53bc0b9108
2 изменённых файлов: 23 добавлений и 13 удалений

Просмотреть файл

@ -0,0 +1,12 @@
/*
* Don't throw a type error if the trap reports an undefined property as
* non-present, regardless of extensibility.
*/
var target = {};
Object.preventExtensions(target);
assertEq(
'foo' in new Proxy(target, {
has: function (target, name) {
return false;
}
}), false);

Просмотреть файл

@ -1933,22 +1933,20 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id,
// step 7
if (!success) {
bool sealed;
if (!IsSealed(cx, target, id, &sealed))
Rooted<PropertyDescriptor> desc(cx);
if (!GetOwnPropertyDescriptor(cx, target, id, &desc))
return false;
if (sealed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
return false;
}
bool extensible;
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (!extensible) {
bool isFixed;
if (!HasOwn(cx, target, id, &isFixed))
if (desc.object()) {
if (desc.isPermanent()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
return false;
if (isFixed) {
}
bool extensible;
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (!extensible) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
return false;
}