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

Unified Diff: src/runtime.cc

Issue 7538016: 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') | test/mjsunit/undeletable-functions.js » ('J')
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 f9652769886c91333542e3a268f3728fed334310..ca83a109915f2b2b3e8560e665ed3a2557492132 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_read_only || is_const_property)) {
+ if (is_local && is_const_property) {
const char* type = (is_read_only) ? "const" : "var";
return ThrowRedeclarationError(isolate, type, name);
}
@@ -1406,12 +1406,11 @@ 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. Since we're trying to
- // overwrite it with a variable declaration we must throw a
- // re-declaration error. However if we found readonly property
+ // The property is present, but read-only, so we ignore the
+ // redeclaration. However if we found readonly property
// on one of hidden prototypes, just shadow it.
if (real_holder != isolate->context()->global()) break;
- return ThrowRedeclarationError(isolate, "const", name);
+ return isolate->heap()->undefined_value();
}
}
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | test/mjsunit/undeletable-functions.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698