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

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

Issue 149249: Fix issue number 398: replacing a constant function on a clone. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « src/objects.cc ('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 2377)
+++ test/cctest/test-api.cc (working copy)
@@ -7041,3 +7041,21 @@
CHECK(!result->IsUndefined());
CHECK_EQ(42, result->Int32Value());
}
+
+
+// Regression test for issue 398.
+// If a function is added to an object, creating a constant function
+// field, and the result is cloned, replacing the constant function on the
+// original should not affect the clone.
+// See http://code.google.com/p/v8/issues/detail?id=398
+THREADED_TEST(ReplaceConstantFunction) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Handle<v8::Object> obj = v8::Object::New();
+ v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New();
+ v8::Handle<v8::String> foo_string = v8::String::New("foo");
+ obj->Set(foo_string, func_templ->GetFunction());
+ v8::Handle<v8::Object> obj_clone = obj->Clone();
+ obj_clone->Set(foo_string, v8::String::New("Hello"));
+ CHECK(!obj->Get(foo_string)->IsUndefined());
+}
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698