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

Unified Diff: src/objects.cc

Issue 1427113002: Fix corner-case behavior of Object::SetSuperProperty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 1 month 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') | test/mjsunit/es6/super.js » ('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 10ceb58407f57ac86c41887655903e4490d44c2a..7422aec4e6603ddbbf52a3295a9fea13e8da9b6b 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3738,6 +3738,9 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
+ // The property either doesn't exist on the holder or exists there as a data
+ // property.
+
if (!it->GetReceiver()->IsJSReceiver()) {
return WriteToReadOnlyProperty(it, value, should_throw);
}
@@ -3758,8 +3761,8 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
break;
case LookupIterator::INTEGER_INDEXED_EXOTIC:
- return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
- value, should_throw);
+ return RedefineIncompatibleProperty(it->isolate(), it->GetName(), value,
+ should_throw);
case LookupIterator::DATA: {
PropertyDetails details = own_lookup.property_details();
@@ -3771,14 +3774,8 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
}
case LookupIterator::ACCESSOR: {
- PropertyDetails details = own_lookup.property_details();
- if (details.IsConfigurable()) {
- return JSObject::DefineOwnPropertyIgnoreAttributes(
- &own_lookup, value, details.attributes(), should_throw);
- }
-
- return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
- value, should_throw);
+ return RedefineIncompatibleProperty(it->isolate(), it->GetName(), value,
+ should_throw);
}
case LookupIterator::INTERCEPTOR:
@@ -3857,10 +3854,10 @@ Maybe<bool> Object::WriteToReadOnlyProperty(Isolate* isolate,
}
-Maybe<bool> Object::RedefineNonconfigurableProperty(Isolate* isolate,
- Handle<Object> name,
- Handle<Object> value,
- ShouldThrow should_throw) {
+Maybe<bool> Object::RedefineIncompatibleProperty(Isolate* isolate,
+ Handle<Object> name,
+ Handle<Object> value,
+ ShouldThrow should_throw) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kRedefineDisallowed, name));
}
@@ -4850,8 +4847,8 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
return Just(true);
}
case LookupIterator::INTEGER_INDEXED_EXOTIC:
- return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
- value, should_throw);
+ return RedefineIncompatibleProperty(it->isolate(), it->GetName(), value,
+ should_throw);
case LookupIterator::DATA: {
PropertyDetails details = it->property_details();
@@ -4864,8 +4861,8 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
// Special case: properties of typed arrays cannot be reconfigured to
// non-writable nor to non-enumerable.
if (it->IsElement() && object->HasFixedTypedArrayElements()) {
- return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
- value, should_throw);
+ return RedefineIncompatibleProperty(it->isolate(), it->GetName(),
+ value, should_throw);
}
// Reconfigure the data property if the attributes mismatch.
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/es6/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698