Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f3d492955bfab448238de125ab7e519fc497085c..12b206cce9fb863d23bc9e611126ea5c0a1cb70f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -4209,15 +4209,6 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, |
if (done) break; |
} |
- // If the receiver is the JSGlobalObject, the store was contextual. In case |
- // the property did not exist yet on the global object itself, we have to |
- // throw a reference error in strict mode. In sloppy mode, we continue. |
- if (it->GetReceiver()->IsJSGlobalObject() && is_strict(language_mode)) { |
- it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError( |
- MessageTemplate::kNotDefined, it->name())); |
- return Nothing<bool>(); |
- } |
- |
*found = false; |
return Nothing<bool>(); |
} |
@@ -4230,6 +4221,16 @@ Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value, |
Maybe<bool> result = |
SetPropertyInternal(it, value, language_mode, store_mode, &found); |
if (found) return result; |
+ |
+ // If the receiver is the JSGlobalObject, the store was contextual. In case |
+ // the property did not exist yet on the global object itself, we have to |
+ // throw a reference error in strict mode. In sloppy mode, we continue. |
+ if (is_strict(language_mode) && it->GetReceiver()->IsJSGlobalObject()) { |
+ it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError( |
+ MessageTemplate::kNotDefined, it->name())); |
+ return Nothing<bool>(); |
+ } |
+ |
ShouldThrow should_throw = |
is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; |
return AddDataProperty(it, value, NONE, should_throw, store_mode); |