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

Unified Diff: test/cctest/test-api.cc

Issue 151191: Make global variable initialization consistent with Firefox and Safari... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | « src/runtime.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 2324)
+++ test/cctest/test-api.cc (working copy)
@@ -7024,3 +7024,20 @@
calling_context1.Clear();
calling_context2.Clear();
}
+
+
+// Check that a variable declaration with no explicit initialization
+// value does not shadow an existing property in the prototype chain.
+//
+// This is consistent with Firefox and Safari.
+//
+// See http://crbug.com/12548.
+THREADED_TEST(InitGlobalVarInProtoChain) {
+ v8::HandleScope scope;
+ LocalContext context;
+ // Introduce a variable in the prototype chain.
+ CompileRun("__proto__.x = 42");
+ v8::Handle<v8::Value> result = CompileRun("var x; x");
+ CHECK(!result->IsUndefined());
+ CHECK_EQ(42, result->Int32Value());
+}
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698