Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: src/objects.cc

Issue 1973513002: Interceptors expect the receiver to always be an JSReceiver. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | test/cctest/test-accessors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 5648f667b841d601fc7810ab5f06b2eeb89d0c4d..43ba1df47cf3588018b4a4234ae55db8b9e39aa4 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4110,8 +4110,14 @@ Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
Handle<JSObject> holder = it->GetHolder<JSObject>();
bool result;
- PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder, should_throw);
+ Handle<Object> receiver = it->GetReceiver();
+ if (!receiver->IsJSReceiver()) {
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
+ Object::ConvertReceiver(isolate, receiver),
+ Nothing<bool>());
+ }
+ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
+ *holder, should_throw);
if (it->IsElement()) {
uint32_t index = it->index();
@@ -5393,9 +5399,14 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
!interceptor->can_intercept_symbols()) {
return Just(ABSENT);
}
- PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder,
- Object::DONT_THROW);
+ Handle<Object> receiver = it->GetReceiver();
+ if (!receiver->IsJSReceiver()) {
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
+ Object::ConvertReceiver(isolate, receiver),
+ Nothing<PropertyAttributes>());
+ }
+ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
+ *holder, Object::DONT_THROW);
if (!interceptor->query()->IsUndefined()) {
Handle<Object> result;
if (it->IsElement()) {
@@ -5839,9 +5850,15 @@ Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it,
if (interceptor->deleter()->IsUndefined()) return Nothing<bool>();
Handle<JSObject> holder = it->GetHolder<JSObject>();
+ Handle<Object> receiver = it->GetReceiver();
+ if (!receiver->IsJSReceiver()) {
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
+ Object::ConvertReceiver(isolate, receiver),
+ Nothing<bool>());
+ }
- PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder, should_throw);
+ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
+ *holder, should_throw);
Handle<Object> result;
if (it->IsElement()) {
uint32_t index = it->index();
@@ -14946,9 +14963,13 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
Handle<JSObject> holder = it->GetHolder<JSObject>();
Handle<Object> result;
- PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder,
- Object::DONT_THROW);
+ Handle<Object> receiver = it->GetReceiver();
+ if (!receiver->IsJSReceiver()) {
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, receiver, Object::ConvertReceiver(isolate, receiver), Object);
+ }
+ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
+ *holder, Object::DONT_THROW);
if (it->IsElement()) {
uint32_t index = it->index();
« no previous file with comments | « src/ic/ic.cc ('k') | test/cctest/test-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698