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

Unified Diff: src/runtime.cc

Issue 7562005: Revert "Make window.{undefined,NaN,Infinity} read-only" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | « no previous file | src/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 77f85b2fcc7a154814d8bd410bbc31e246347028..8c43d64536c380f3d5d33a7214c332d306931042 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1172,7 +1172,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
return ThrowRedeclarationError(isolate, "const", name);
}
// Otherwise, we check for locally conflicting declarations.
- if (is_local && is_const_property) {
+ if (is_local && (is_read_only || is_const_property)) {
const char* type = (is_read_only) ? "const" : "var";
return ThrowRedeclarationError(isolate, type, name);
}
@@ -1406,11 +1406,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
// make sure to introduce it.
found = false;
} else if ((intercepted & READ_ONLY) != 0) {
- // The property is present, but read-only, so we ignore the
- // redeclaration. However if we found readonly property
+ // The property is present, but read-only. Since we're trying to
+ // overwrite it with a variable declaration we must throw a
+ // re-declaration error. However if we found readonly property
// on one of hidden prototypes, just shadow it.
if (real_holder != isolate->context()->global()) break;
- return isolate->heap()->undefined_value();
+ return ThrowRedeclarationError(isolate, "const", name);
}
}
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698