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(); |
} |
} |