From edacd8000ae3ceaade6cc11e15b942068e00b320 Mon Sep 17 00:00:00 2001 From: Yuki Shiino Date: Fri, 26 Jul 2019 22:54:34 +0900 Subject: [PATCH] Invoke access-check-interceptor in GetOwnPropertyDescriptor Object::Get, Set, etc. properly invoke an interceptor registered via SetAccessCheckCallbackAndHandler, however, Object::GetOwnPropertyDescriptor does not invoke an interceptor. This patch supports access-check-interceptor for descriptors. Change-Id: Ie2b2f2456be95c6eef8c2cdfee2bdd651c011fa3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1720969 Reviewed-by: Toon Verwaest Commit-Queue: Yuki Shiino Cr-Commit-Position: refs/heads/master@{#62978} --- src/objects/js-objects.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/objects/js-objects.cc b/src/objects/js-objects.cc index 5c4db16206..b30b6db033 100644 --- a/src/objects/js-objects.cc +++ b/src/objects/js-objects.cc @@ -1509,20 +1509,27 @@ namespace { Maybe GetPropertyDescriptorWithInterceptor(LookupIterator* it, PropertyDescriptor* desc) { + Handle interceptor; + if (it->state() == LookupIterator::ACCESS_CHECK) { if (it->HasAccess()) { it->Next(); - } else if (!JSObject::AllCanRead(it) || - it->state() != LookupIterator::INTERCEPTOR) { - it->Restart(); - return Just(false); + } else { + interceptor = it->GetInterceptorForFailedAccessCheck(); + if (interceptor.is_null() && + (!JSObject::AllCanRead(it) || + it->state() != LookupIterator::INTERCEPTOR)) { + it->Restart(); + return Just(false); + } } } - if (it->state() != LookupIterator::INTERCEPTOR) return Just(false); - + if (it->state() == LookupIterator::INTERCEPTOR) { + interceptor = it->GetInterceptor(); + } + if (interceptor.is_null()) return Just(false); Isolate* isolate = it->isolate(); - Handle interceptor = it->GetInterceptor(); if (interceptor->descriptor().IsUndefined(isolate)) return Just(false); Handle result;