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 <verwaest@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62978}
This commit is contained in:
Yuki Shiino 2019-07-26 22:54:34 +09:00 committed by Commit Bot
parent 51afbd1a46
commit edacd8000a

View File

@ -1509,20 +1509,27 @@ namespace {
Maybe<bool> GetPropertyDescriptorWithInterceptor(LookupIterator* it,
PropertyDescriptor* desc) {
Handle<InterceptorInfo> 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<InterceptorInfo> interceptor = it->GetInterceptor();
if (interceptor->descriptor().IsUndefined(isolate)) return Just(false);
Handle<Object> result;