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

Unified Diff: src/objects.cc

Issue 1587073003: Array length reduction should throw in strict mode if it can't delete an element. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing for relanding Created 4 years, 11 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/objects.h ('k') | src/objects-printer.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 bdf9a6c0f301a91f8abde905d738e49d2dba7ac7..6c2ff15bed657f8c1f10abfeee262b638dfac80e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1159,7 +1159,8 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(
if (call_fun == nullptr) return isolate->factory()->undefined_value();
LOG(isolate, ApiNamedPropertyAccess("load", *holder, *name));
- PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder);
+ PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder,
+ Object::DONT_THROW);
v8::Local<v8::Value> result = args.Call(call_fun, v8::Utils::ToLocal(name));
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (result.IsEmpty()) {
@@ -1224,7 +1225,8 @@ Maybe<bool> Object::SetPropertyWithAccessor(LookupIterator* it,
// earlier?
LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name));
- PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder);
+ PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder,
+ should_throw);
args.Call(call_fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value));
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
return Just(true);
@@ -3996,6 +3998,7 @@ Handle<Map> Map::Update(Handle<Map> map) {
Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
+ ShouldThrow should_throw,
Handle<Object> value) {
Isolate* isolate = it->isolate();
// Make sure that the top context does not change when doing callbacks or
@@ -4009,7 +4012,7 @@ Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
Handle<JSObject> holder = it->GetHolder<JSObject>();
v8::Local<v8::Value> result;
PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder);
+ *it->GetReceiver(), *holder, should_throw);
if (it->IsElement()) {
uint32_t index = it->index();
@@ -4090,7 +4093,8 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
case LookupIterator::INTERCEPTOR:
if (it->HolderIsReceiverOrHiddenPrototype()) {
- Maybe<bool> result = JSObject::SetPropertyWithInterceptor(it, value);
+ Maybe<bool> result =
+ JSObject::SetPropertyWithInterceptor(it, should_throw, value);
if (result.IsNothing() || result.FromJust()) return result;
} else {
Maybe<PropertyAttributes> maybe_attributes =
@@ -5250,7 +5254,8 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
// they throw. Here we should do the same.
case LookupIterator::INTERCEPTOR:
if (handling == DONT_FORCE_FIELD) {
- Maybe<bool> result = JSObject::SetPropertyWithInterceptor(it, value);
+ Maybe<bool> result =
+ JSObject::SetPropertyWithInterceptor(it, should_throw, value);
if (result.IsNothing() || result.FromJust()) return result;
}
break;
@@ -5373,7 +5378,8 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
return Just(ABSENT);
}
PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder);
+ *it->GetReceiver(), *holder,
+ Object::DONT_THROW);
if (!interceptor->query()->IsUndefined()) {
v8::Local<v8::Integer> result;
if (it->IsElement()) {
@@ -6129,7 +6135,8 @@ Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
}
-Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it) {
+Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it,
+ ShouldThrow should_throw) {
Isolate* isolate = it->isolate();
// Make sure that the top context does not change when doing callbacks or
// interceptor calls.
@@ -6142,7 +6149,7 @@ Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it) {
Handle<JSObject> holder = it->GetHolder<JSObject>();
PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder);
+ *it->GetReceiver(), *holder, should_throw);
v8::Local<v8::Boolean> result;
if (it->IsElement()) {
uint32_t index = it->index();
@@ -6240,7 +6247,10 @@ Maybe<bool> JSReceiver::DeleteProperty(LookupIterator* it,
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
return Just(false);
case LookupIterator::INTERCEPTOR: {
- Maybe<bool> result = JSObject::DeletePropertyWithInterceptor(it);
+ ShouldThrow should_throw =
+ is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR;
+ Maybe<bool> result =
+ JSObject::DeletePropertyWithInterceptor(it, should_throw);
// An exception was thrown in the interceptor. Propagate.
if (isolate->has_pending_exception()) return Nothing<bool>();
// Delete with interceptor succeeded. Return result.
@@ -8565,7 +8575,7 @@ static Maybe<bool> GetKeysFromInterceptor(Isolate* isolate,
return Just(true);
}
PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
- *object);
+ *object, Object::DONT_THROW);
v8::Local<v8::Object> result;
if (!interceptor->enumerator()->IsUndefined()) {
Callback enum_fun = v8::ToCData<Callback>(interceptor->enumerator());
@@ -16215,7 +16225,8 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
Handle<JSObject> holder = it->GetHolder<JSObject>();
v8::Local<v8::Value> result;
PropertyCallbackArguments args(isolate, interceptor->data(),
- *it->GetReceiver(), *holder);
+ *it->GetReceiver(), *holder,
+ Object::DONT_THROW);
if (it->IsElement()) {
uint32_t index = it->index();
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698