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

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

Issue 11227: Fixing wrong reference to this in eval. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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/v8natives.js ('k') | no next file » | 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 782)
+++ test/cctest/test-api.cc (working copy)
@@ -4029,8 +4029,16 @@
" var foo = 2;"
" return eval('foo');"
"})();"));
- Local<Value> foo = script->Run();
- CHECK_EQ(2, foo->Int32Value());
+ Local<Value> result = script->Run();
+ CHECK_EQ(2, result->Int32Value());
+
+ // Test that un-aliased eval has right this.
+ script =
+ Script::Compile(v8_str("function MyObject() { this.self = eval('this'); }"
+ "var o = new MyObject();"
+ "o === o.self"));
+ result = script->Run();
+ CHECK(result->IsTrue());
}
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698