Commit 6b15cdb2 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[runtime] Check for named interceptors that can't deal with symbols in the lookup iterator

BUG=

Change-Id: I5a4d398283c6fbbbc778d6f6c4555763f8869249
Reviewed-on: https://chromium-review.googlesource.com/452581Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43723}
parent 9aed0c43
...@@ -764,7 +764,9 @@ void LookupIterator::WriteDataValue(Handle<Object> value, ...@@ -764,7 +764,9 @@ void LookupIterator::WriteDataValue(Handle<Object> value,
template <bool is_element> template <bool is_element>
bool LookupIterator::SkipInterceptor(JSObject* holder) { bool LookupIterator::SkipInterceptor(JSObject* holder) {
auto info = GetInterceptor<is_element>(holder); auto info = GetInterceptor<is_element>(holder);
// TODO(dcarney): check for symbol/can_intercept_symbols here as well. if (!is_element && name_->IsSymbol() && !info->can_intercept_symbols()) {
return true;
}
if (info->non_masking()) { if (info->non_masking()) {
switch (interceptor_state_) { switch (interceptor_state_) {
case InterceptorState::kUninitialized: case InterceptorState::kUninitialized:
......
...@@ -1620,9 +1620,7 @@ MaybeHandle<Object> GetPropertyWithInterceptorInternal( ...@@ -1620,9 +1620,7 @@ MaybeHandle<Object> GetPropertyWithInterceptorInternal(
Handle<Name> name = it->name(); Handle<Name> name = it->name();
DCHECK(!name->IsPrivate()); DCHECK(!name->IsPrivate());
if (name->IsSymbol() && !interceptor->can_intercept_symbols()) { DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
return isolate->factory()->undefined_value();
}
v8::GenericNamedPropertyGetterCallback getter = v8::GenericNamedPropertyGetterCallback getter =
v8::ToCData<v8::GenericNamedPropertyGetterCallback>( v8::ToCData<v8::GenericNamedPropertyGetterCallback>(
...@@ -1646,10 +1644,8 @@ Maybe<PropertyAttributes> GetPropertyAttributesWithInterceptorInternal( ...@@ -1646,10 +1644,8 @@ Maybe<PropertyAttributes> GetPropertyAttributesWithInterceptorInternal(
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSObject> holder = it->GetHolder<JSObject>(); Handle<JSObject> holder = it->GetHolder<JSObject>();
if (!it->IsElement() && it->name()->IsSymbol() && DCHECK_IMPLIES(!it->IsElement() && it->name()->IsSymbol(),
!interceptor->can_intercept_symbols()) { interceptor->can_intercept_symbols());
return Just(ABSENT);
}
Handle<Object> receiver = it->GetReceiver(); Handle<Object> receiver = it->GetReceiver();
if (!receiver->IsJSReceiver()) { if (!receiver->IsJSReceiver()) {
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
...@@ -1733,9 +1729,7 @@ Maybe<bool> SetPropertyWithInterceptorInternal( ...@@ -1733,9 +1729,7 @@ Maybe<bool> SetPropertyWithInterceptorInternal(
Handle<Name> name = it->name(); Handle<Name> name = it->name();
DCHECK(!name->IsPrivate()); DCHECK(!name->IsPrivate());
if (name->IsSymbol() && !interceptor->can_intercept_symbols()) { DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
return Just(false);
}
v8::GenericNamedPropertySetterCallback setter = v8::GenericNamedPropertySetterCallback setter =
v8::ToCData<v8::GenericNamedPropertySetterCallback>( v8::ToCData<v8::GenericNamedPropertySetterCallback>(
...@@ -1798,9 +1792,7 @@ Maybe<bool> DefinePropertyWithInterceptorInternal( ...@@ -1798,9 +1792,7 @@ Maybe<bool> DefinePropertyWithInterceptorInternal(
Handle<Name> name = it->name(); Handle<Name> name = it->name();
DCHECK(!name->IsPrivate()); DCHECK(!name->IsPrivate());
if (name->IsSymbol() && !interceptor->can_intercept_symbols()) { DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
return Just(false);
}
v8::GenericNamedPropertyDefinerCallback definer = v8::GenericNamedPropertyDefinerCallback definer =
v8::ToCData<v8::GenericNamedPropertyDefinerCallback>( v8::ToCData<v8::GenericNamedPropertyDefinerCallback>(
...@@ -5950,9 +5942,9 @@ Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it, ...@@ -5950,9 +5942,9 @@ Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it,
v8::IndexedPropertyDeleterCallback deleter = v8::IndexedPropertyDeleterCallback deleter =
v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter()); v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter());
result = args.Call(deleter, index); result = args.Call(deleter, index);
} else if (it->name()->IsSymbol() && !interceptor->can_intercept_symbols()) {
return Nothing<bool>();
} else { } else {
DCHECK_IMPLIES(it->name()->IsSymbol(),
interceptor->can_intercept_symbols());
Handle<Name> name = it->name(); Handle<Name> name = it->name();
DCHECK(!name->IsPrivate()); DCHECK(!name->IsPrivate());
v8::GenericNamedPropertyDeleterCallback deleter = v8::GenericNamedPropertyDeleterCallback deleter =
......
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