Commit adc02150 authored by verwaest's avatar verwaest Committed by Commit bot

Propagate not-found on proxy target to GetRealNamedProperty

BUG=v8:4932
LOG=n

Review-Url: https://codereview.chromium.org/1929853002
Cr-Commit-Position: refs/heads/master@{#35846}
parent 47ffcac6
...@@ -720,9 +720,14 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { ...@@ -720,9 +720,14 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
case LookupIterator::NOT_FOUND: case LookupIterator::NOT_FOUND:
case LookupIterator::TRANSITION: case LookupIterator::TRANSITION:
UNREACHABLE(); UNREACHABLE();
case LookupIterator::JSPROXY: case LookupIterator::JSPROXY: {
return JSProxy::GetProperty(it->isolate(), it->GetHolder<JSProxy>(), bool was_found;
it->GetName(), it->GetReceiver()); MaybeHandle<Object> result =
JSProxy::GetProperty(it->isolate(), it->GetHolder<JSProxy>(),
it->GetName(), it->GetReceiver(), &was_found);
if (!was_found) it->NotFound();
return result;
}
case LookupIterator::INTERCEPTOR: { case LookupIterator::INTERCEPTOR: {
bool done; bool done;
Handle<Object> result; Handle<Object> result;
...@@ -762,7 +767,9 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { ...@@ -762,7 +767,9 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate,
Handle<JSProxy> proxy, Handle<JSProxy> proxy,
Handle<Name> name, Handle<Name> name,
Handle<Object> receiver) { Handle<Object> receiver,
bool* was_found) {
*was_found = true;
if (receiver->IsJSGlobalObject()) { if (receiver->IsJSGlobalObject()) {
THROW_NEW_ERROR( THROW_NEW_ERROR(
isolate, isolate,
...@@ -795,7 +802,9 @@ MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, ...@@ -795,7 +802,9 @@ MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate,
// 7.a Return target.[[Get]](P, Receiver). // 7.a Return target.[[Get]](P, Receiver).
LookupIterator it = LookupIterator it =
LookupIterator::PropertyOrElement(isolate, receiver, name, target); LookupIterator::PropertyOrElement(isolate, receiver, name, target);
return Object::GetProperty(&it); MaybeHandle<Object> result = Object::GetProperty(&it);
*was_found = it.IsFound();
return result;
} }
// 8. Let trapResult be ? Call(trap, handler, «target, P, Receiver»). // 8. Let trapResult be ? Call(trap, handler, «target, P, Receiver»).
Handle<Object> trap_result; Handle<Object> trap_result;
......
...@@ -9682,7 +9682,7 @@ class JSProxy: public JSReceiver { ...@@ -9682,7 +9682,7 @@ class JSProxy: public JSReceiver {
// ES6 9.5.8 // ES6 9.5.8
MUST_USE_RESULT static MaybeHandle<Object> GetProperty( MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
Handle<Object> receiver); Handle<Object> receiver, bool* was_found);
// ES6 9.5.9 // ES6 9.5.9
MUST_USE_RESULT static Maybe<bool> SetProperty(Handle<JSProxy> proxy, MUST_USE_RESULT static Maybe<bool> SetProperty(Handle<JSProxy> proxy,
......
...@@ -12870,6 +12870,19 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) { ...@@ -12870,6 +12870,19 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) {
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
try_catch.Reset(); try_catch.Reset();
CHECK(result.IsEmpty()); CHECK(result.IsEmpty());
Local<Object> target = CompileRun("({})").As<Object>();
Local<Object> handler = CompileRun("({})").As<Object>();
Local<v8::Proxy> proxy =
v8::Proxy::New(context.local(), target, handler).ToLocalChecked();
result = target->GetRealNamedProperty(context.local(), v8_str("f"));
CHECK(!try_catch.HasCaught());
CHECK(result.IsEmpty());
result = proxy->GetRealNamedProperty(context.local(), v8_str("f"));
CHECK(!try_catch.HasCaught());
CHECK(result.IsEmpty());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment