зеркало из https://github.com/mozilla/gecko-dev.git
Bug 978229 - Part 1: Remove IsSealed() from Proxy.[[HasProperty]]. (r=jorendorff)
This commit is contained in:
Родитель
73f240d1d3
Коммит
53bc0b9108
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче