Reviewers: Jakob,
Message:
PTAL
Description:
Ensure a type-error is thrown when trying to assign to a readonly property
on
the global scope.
Please review this at https://chromiumcodereview.appspot.com/11953056/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/ic.cc
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index
5e8e0e060e633154b3faf7ffc9a0ac15fc57e0af..49b33776cea839863b381ae3b4dbc5c485138c29
100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1463,7 +1463,9 @@ MaybeObject* StoreIC::Store(State state,
if (FLAG_use_ic) {
UpdateStoreCaches(&lookup, state, strict_mode, receiver, name,
value);
}
- } else if (strict_mode == kStrictMode && IsUndeclaredGlobal(object)) {
+ } else if (strict_mode == kStrictMode &&
+ !(lookup.IsProperty() && lookup.IsReadOnly()) &&
+ IsUndeclaredGlobal(object)) {
// Strict mode doesn't allow setting non-existent global property.
return ReferenceError("not_defined", name);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev