Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 440d38c9f8ffe157a7d9a612a3e4832ed3e11ccd..6ac55fc5189b226784c10e3bcbc24a0f3f729603 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -986,8 +986,8 @@ MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { |
// 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError. |
if (!(handler_proto->IsJSReceiver() || handler_proto->IsNull())) { |
THROW_NEW_ERROR(isolate, |
- NewTypeError(MessageTemplate::kProxyHandlerTrapMissing, |
- handler, trap_name), |
+ NewTypeError(MessageTemplate::kProxyTrapReturnedNonObject, |
+ handler, handler_proto, trap_name), |
Object); |
} |
// 9. Let extensibleTarget be ? IsExtensible(target). |
@@ -1319,6 +1319,11 @@ Maybe<bool> Object::HasInPrototypeChain(Isolate* isolate, Handle<Object> object, |
PrototypeIterator iter(isolate, object, PrototypeIterator::START_AT_RECEIVER); |
while (true) { |
if (!iter.AdvanceFollowingProxies()) return Nothing<bool>(); |
+ if (!iter.HasAccess()) { |
+ isolate->ReportFailedAccessCheck( |
+ PrototypeIterator::GetCurrent<JSObject>(iter)); |
+ return Nothing<bool>(); |
+ } |
if (iter.IsAtEnd()) return Just(false); |
if (iter.IsAtEnd(proto)) return Just(true); |
} |
@@ -4724,8 +4729,8 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, |
Nothing<bool>()); |
if (!trap_result->BooleanValue()) { |
RETURN_FAILURE(isolate, should_throw, |
- NewTypeError(MessageTemplate::kProxyHandlerReturned, handler, |
- factory->false_string(), trap_name)); |
+ NewTypeError(MessageTemplate::kProxyTrapReturnedFalseish, |
+ handler, trap_result, trap_name)); |
} |
// Enforce the invariant. |
@@ -4782,8 +4787,8 @@ Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy, |
Nothing<bool>()); |
if (!trap_result->BooleanValue()) { |
RETURN_FAILURE(isolate, should_throw, |
- NewTypeError(MessageTemplate::kProxyHandlerReturned, handler, |
- factory->false_string(), trap_name)); |
+ NewTypeError(MessageTemplate::kProxyTrapReturnedFalseish, |
+ handler, trap_result, trap_name)); |
} |
// Enforce the invariant. |
@@ -6835,10 +6840,9 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, |
Nothing<bool>()); |
// 10. If booleanTrapResult is false, return false. |
if (!trap_result_obj->BooleanValue()) { |
- // TODO(jkummerow): Better error message? |
RETURN_FAILURE(isolate, should_throw, |
- NewTypeError(MessageTemplate::kProxyHandlerReturned, handler, |
- trap_result_obj, trap_name)); |
+ NewTypeError(MessageTemplate::kProxyTrapReturnedFalseish, |
+ handler, trap_result_obj, trap_name)); |
} |
// 11. Let targetDesc be ? target.[[GetOwnProperty]](P). |
PropertyDescriptor target_desc; |
@@ -7005,8 +7009,8 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
// TypeError exception. |
if (!trap_result_obj->IsJSReceiver() && !trap_result_obj->IsUndefined()) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
- MessageTemplate::kProxyHandlerReturned, handler, trap_result_obj, |
- name)); |
+ MessageTemplate::kProxyTrapReturnedFalseish, handler, trap_result_obj, |
+ trap_name)); |
return Nothing<bool>(); |
} |
// 10. Let targetDesc be ? target.[[GetOwnProperty]](P). |
@@ -7062,7 +7066,8 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
if (target_desc.is_empty() || target_desc.configurable()) { |
// 17a i. Throw a TypeError exception. |
isolate->Throw(*isolate->factory()->NewTypeError( |
- MessageTemplate::kRedefineDisallowed, name)); |
+ MessageTemplate::kProxyTrapDescriptorNonConfigurable, trap_name, |
+ name)); |
return Nothing<bool>(); |
} |
} |
@@ -7345,8 +7350,8 @@ Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy, |
Nothing<bool>()); |
if (!trap_result->BooleanValue()) { |
RETURN_FAILURE(isolate, should_throw, |
- NewTypeError(MessageTemplate::kProxyHandlerReturned, handler, |
- factory->false_string(), trap_name)); |
+ NewTypeError(MessageTemplate::kProxyTrapReturned, handler, |
+ trap_result, trap_name)); |
} |
// Enforce the invariant. |
@@ -8584,7 +8589,8 @@ Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate, |
int* found = unchecked_result_keys.Find(key); |
if (found == nullptr || *found == kGone) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
- MessageTemplate::kProxyTrapResultMustInclude, handle(key, isolate))); |
+ MessageTemplate::kProxyTrapOwnKeysResultMustInclude, |
+ handle(key, isolate))); |
return Nothing<bool>(); |
} |
// 17b. Remove key from uncheckedResultKeys. |
@@ -8604,7 +8610,8 @@ Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate, |
int* found = unchecked_result_keys.Find(key); |
if (found == nullptr || *found == kGone) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
- MessageTemplate::kProxyTrapResultMustInclude, handle(key, isolate))); |
+ MessageTemplate::kProxyTrapOwnKeysResultMustInclude, |
+ handle(key, isolate))); |
return Nothing<bool>(); |
} |
// 19b. Remove key from uncheckedResultKeys. |