| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index ce840e228d6851c83bcfaee439584c724718d362..25d934be7ca790dcb453f5710dcaf44b8044cda6 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -6135,7 +6135,8 @@ Maybe<bool> JSReceiver::DeletePropertyOrElement(Handle<JSReceiver> object,
|
| // static
|
| Object* JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
|
| Handle<Object> key,
|
| - Handle<Object> attributes) {
|
| + Handle<Object> attributes,
|
| + CallInterceptors call_interceptors) {
|
| // 1. If Type(O) is not Object, throw a TypeError exception.
|
| if (!object->IsJSReceiver()) {
|
| Handle<String> fun_name =
|
| @@ -6153,8 +6154,9 @@ Object* JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
|
| return isolate->heap()->exception();
|
| }
|
| // 6. Let success be DefinePropertyOrThrow(O,key, desc).
|
| - Maybe<bool> success = DefineOwnProperty(
|
| - isolate, Handle<JSReceiver>::cast(object), key, &desc, THROW_ON_ERROR);
|
| + Maybe<bool> success =
|
| + DefineOwnProperty(isolate, Handle<JSReceiver>::cast(object), key, &desc,
|
| + THROW_ON_ERROR, call_interceptors);
|
| // 7. ReturnIfAbrupt(success).
|
| MAYBE_RETURN(success, isolate->heap()->exception());
|
| CHECK(success.FromJust());
|
| @@ -6162,7 +6164,6 @@ Object* JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
|
| return *object;
|
| }
|
|
|
| -
|
| // ES6 19.1.2.3.1
|
| // static
|
| MaybeHandle<Object> JSReceiver::DefineProperties(Isolate* isolate,
|
| @@ -6246,18 +6247,22 @@ Maybe<bool> JSReceiver::DefineOwnProperty(Isolate* isolate,
|
| Handle<JSReceiver> object,
|
| Handle<Object> key,
|
| PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| + ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| if (object->IsJSArray()) {
|
| return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object),
|
| - key, desc, should_throw);
|
| + key, desc, should_throw,
|
| + call_interceptors);
|
| }
|
| if (object->IsJSProxy()) {
|
| return JSProxy::DefineOwnProperty(isolate, Handle<JSProxy>::cast(object),
|
| - key, desc, should_throw);
|
| + key, desc, should_throw,
|
| + call_interceptors);
|
| }
|
| if (object->IsJSTypedArray()) {
|
| return JSTypedArray::DefineOwnProperty(
|
| - isolate, Handle<JSTypedArray>::cast(object), key, desc, should_throw);
|
| + isolate, Handle<JSTypedArray>::cast(object), key, desc, should_throw,
|
| + call_interceptors);
|
| }
|
| // TODO(neis): Special case for JSModuleNamespace?
|
|
|
| @@ -6265,20 +6270,25 @@ Maybe<bool> JSReceiver::DefineOwnProperty(Isolate* isolate,
|
| // DefineOwnPropertyIgnoreAttributes, can handle arguments
|
| // (ES#sec-arguments-exotic-objects-defineownproperty-p-desc).
|
| return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key,
|
| - desc, should_throw);
|
| + desc, should_throw, call_interceptors);
|
| }
|
|
|
| -
|
| // static
|
| -Maybe<bool> JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate,
|
| - Handle<JSObject> object,
|
| - Handle<Object> key,
|
| - PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| +Maybe<bool> JSReceiver::OrdinaryDefineOwnProperty(
|
| + Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
|
| + PropertyDescriptor* desc, ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| bool success = false;
|
| DCHECK(key->IsName() || key->IsNumber()); // |key| is a PropertyKey...
|
| +
|
| + LookupIterator::Configuration iterator_config = LookupIterator::OWN;
|
| + if (call_interceptors == CallInterceptors::SKIP_INTERCEPTORS) {
|
| + iterator_config = LookupIterator::OWN_SKIP_INTERCEPTOR;
|
| + }
|
| +
|
| LookupIterator it = LookupIterator::PropertyOrElement(
|
| - isolate, object, key, &success, LookupIterator::OWN);
|
| + isolate, object, key, &success, iterator_config);
|
| +
|
| DCHECK(success); // ...so creating a LookupIterator can't fail.
|
|
|
| // Deal with access checks first.
|
| @@ -6675,13 +6685,14 @@ bool PropertyKeyToArrayIndex(Handle<Object> index_obj, uint32_t* output) {
|
| Maybe<bool> JSArray::DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
|
| Handle<Object> name,
|
| PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| + ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| // 1. Assert: IsPropertyKey(P) is true. ("P" is |name|.)
|
| // 2. If P is "length", then:
|
| // TODO(jkummerow): Check if we need slow string comparison.
|
| if (*name == isolate->heap()->length_string()) {
|
| // 2a. Return ArraySetLength(A, Desc).
|
| - return ArraySetLength(isolate, o, desc, should_throw);
|
| + return ArraySetLength(isolate, o, desc, should_throw, call_interceptors);
|
| }
|
| // 3. Else if P is an array index, then:
|
| uint32_t index = 0;
|
| @@ -6707,8 +6718,8 @@ Maybe<bool> JSArray::DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
|
| NewTypeError(MessageTemplate::kDefineDisallowed, name));
|
| }
|
| // 3g. Let succeeded be OrdinaryDefineOwnProperty(A, P, Desc).
|
| - Maybe<bool> succeeded =
|
| - OrdinaryDefineOwnProperty(isolate, o, name, desc, should_throw);
|
| + Maybe<bool> succeeded = OrdinaryDefineOwnProperty(
|
| + isolate, o, name, desc, should_throw, call_interceptors);
|
| // 3h. Assert: succeeded is not an abrupt completion.
|
| // In our case, if should_throw == THROW_ON_ERROR, it can be!
|
| // 3i. If succeeded is false, return false.
|
| @@ -6719,9 +6730,9 @@ Maybe<bool> JSArray::DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
|
| old_len_desc.set_value(isolate->factory()->NewNumberFromUint(index + 1));
|
| // 3j ii. Let succeeded be
|
| // OrdinaryDefineOwnProperty(A, "length", oldLenDesc).
|
| - succeeded = OrdinaryDefineOwnProperty(isolate, o,
|
| - isolate->factory()->length_string(),
|
| - &old_len_desc, should_throw);
|
| + succeeded = OrdinaryDefineOwnProperty(
|
| + isolate, o, isolate->factory()->length_string(), &old_len_desc,
|
| + should_throw, call_interceptors);
|
| // 3j iii. Assert: succeeded is true.
|
| DCHECK(succeeded.FromJust());
|
| USE(succeeded);
|
| @@ -6731,7 +6742,8 @@ Maybe<bool> JSArray::DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
|
| }
|
|
|
| // 4. Return OrdinaryDefineOwnProperty(A, P, Desc).
|
| - return OrdinaryDefineOwnProperty(isolate, o, name, desc, should_throw);
|
| + return OrdinaryDefineOwnProperty(isolate, o, name, desc, should_throw,
|
| + call_interceptors);
|
| }
|
|
|
|
|
| @@ -6776,12 +6788,14 @@ bool JSArray::AnythingToArrayLength(Isolate* isolate,
|
| // static
|
| Maybe<bool> JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a,
|
| PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| + ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| // 1. If the [[Value]] field of Desc is absent, then
|
| if (!desc->has_value()) {
|
| // 1a. Return OrdinaryDefineOwnProperty(A, "length", Desc).
|
| - return OrdinaryDefineOwnProperty(
|
| - isolate, a, isolate->factory()->length_string(), desc, should_throw);
|
| + return OrdinaryDefineOwnProperty(isolate, a,
|
| + isolate->factory()->length_string(), desc,
|
| + should_throw, call_interceptors);
|
| }
|
| // 2. Let newLenDesc be a copy of Desc.
|
| // (Actual copying is not necessary.)
|
| @@ -6809,9 +6823,9 @@ Maybe<bool> JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a,
|
| // 8. Set newLenDesc.[[Value]] to newLen.
|
| // 12a. Return OrdinaryDefineOwnProperty(A, "length", newLenDesc).
|
| new_len_desc->set_value(isolate->factory()->NewNumberFromUint(new_len));
|
| - return OrdinaryDefineOwnProperty(isolate, a,
|
| - isolate->factory()->length_string(),
|
| - new_len_desc, should_throw);
|
| + return OrdinaryDefineOwnProperty(
|
| + isolate, a, isolate->factory()->length_string(), new_len_desc,
|
| + should_throw, call_interceptors);
|
| }
|
| // 13. If oldLenDesc.[[Writable]] is false, return false.
|
| if (!old_len_desc.writable()) {
|
| @@ -6840,7 +6854,7 @@ Maybe<bool> JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a,
|
| readonly.set_writable(false);
|
| Maybe<bool> success = OrdinaryDefineOwnProperty(
|
| isolate, a, isolate->factory()->length_string(), &readonly,
|
| - should_throw);
|
| + should_throw, call_interceptors);
|
| DCHECK(success.FromJust());
|
| USE(success);
|
| }
|
| @@ -6864,7 +6878,8 @@ Maybe<bool> JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a,
|
| Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
|
| Handle<Object> key,
|
| PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| + ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| STACK_CHECK(isolate, Nothing<bool>());
|
| if (key->IsSymbol() && Handle<Symbol>::cast(key)->IsPrivate()) {
|
| return SetPrivateProperty(isolate, proxy, Handle<Symbol>::cast(key), desc,
|
| @@ -6894,7 +6909,7 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
|
| if (trap->IsUndefined(isolate)) {
|
| // 7a. Return target.[[DefineOwnProperty]](P, Desc).
|
| return JSReceiver::DefineOwnProperty(isolate, target, key, desc,
|
| - should_throw);
|
| + should_throw, call_interceptors);
|
| }
|
| // 8. Let descObj be FromPropertyDescriptor(Desc).
|
| Handle<Object> desc_obj = desc->ToObject(isolate);
|
| @@ -17117,11 +17132,10 @@ bool CanonicalNumericIndexString(Isolate* isolate, Handle<Object> s,
|
|
|
| // ES#sec-integer-indexed-exotic-objects-defineownproperty-p-desc
|
| // static
|
| -Maybe<bool> JSTypedArray::DefineOwnProperty(Isolate* isolate,
|
| - Handle<JSTypedArray> o,
|
| - Handle<Object> key,
|
| - PropertyDescriptor* desc,
|
| - ShouldThrow should_throw) {
|
| +Maybe<bool> JSTypedArray::DefineOwnProperty(
|
| + Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
|
| + PropertyDescriptor* desc, ShouldThrow should_throw,
|
| + CallInterceptors call_interceptors) {
|
| // 1. Assert: IsPropertyKey(P) is true.
|
| DCHECK(key->IsName() || key->IsNumber());
|
| // 2. Assert: O is an Object that has a [[ViewedArrayBuffer]] internal slot.
|
| @@ -17182,7 +17196,8 @@ Maybe<bool> JSTypedArray::DefineOwnProperty(Isolate* isolate,
|
| }
|
| }
|
| // 4. Return ! OrdinaryDefineOwnProperty(O, P, Desc).
|
| - return OrdinaryDefineOwnProperty(isolate, o, key, desc, should_throw);
|
| + return OrdinaryDefineOwnProperty(isolate, o, key, desc, should_throw,
|
| + call_interceptors);
|
| }
|
|
|
| ExternalArrayType JSTypedArray::type() {
|
|
|