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

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

Issue 7324027: Fix: FunctionTemplate::SetPrototypeAttributes broke prototype object (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
« src/objects.cc ('K') | « 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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 1531f905d1b078f6286418e3c0096e98350a8a66..70c08975cc06af79b7ee48a71536912d62c43122 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -6885,11 +6885,12 @@ THREADED_TEST(SetPrototype) {
}
-THREADED_TEST(SetPrototypeProperties) {
+THREADED_TEST(SetPrototypeAttributes) {
v8::HandleScope handle_scope;
LocalContext context;
Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New();
+ t1->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42));
t1->SetPrototypeAttributes(v8::DontDelete);
context->Global()->Set(v8_str("func1"), t1->GetFunction());
CHECK(CompileRun(
@@ -6899,8 +6900,10 @@ THREADED_TEST(SetPrototypeProperties) {
" (descriptor['enumerable'] == true) &&"
" (descriptor['configurable'] == false);"
"})()")->BooleanValue());
+ CHECK_EQ(42, CompileRun("func1.prototype.x")->Int32Value());
Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New();
+ t2->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42));
t2->SetPrototypeAttributes(v8::DontEnum);
context->Global()->Set(v8_str("func2"), t2->GetFunction());
CHECK(CompileRun(
@@ -6910,8 +6913,10 @@ THREADED_TEST(SetPrototypeProperties) {
" (descriptor['enumerable'] == false) &&"
" (descriptor['configurable'] == true);"
"})()")->BooleanValue());
+ CHECK_EQ(42, CompileRun("func2.prototype.x")->Int32Value());
Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New();
+ t3->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42));
t3->SetPrototypeAttributes(v8::ReadOnly);
context->Global()->Set(v8_str("func3"), t3->GetFunction());
CHECK(CompileRun(
@@ -6921,8 +6926,10 @@ THREADED_TEST(SetPrototypeProperties) {
" (descriptor['enumerable'] == true) &&"
" (descriptor['configurable'] == true);"
"})()")->BooleanValue());
+ CHECK_EQ(42, CompileRun("func3.prototype.x")->Int32Value());
Local<v8::FunctionTemplate> t4 = v8::FunctionTemplate::New();
+ t4->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42));
t4->SetPrototypeAttributes(v8::ReadOnly | v8::DontEnum | v8::DontDelete);
context->Global()->Set(v8_str("func4"), t4->GetFunction());
CHECK(CompileRun(
@@ -6932,6 +6939,7 @@ THREADED_TEST(SetPrototypeProperties) {
" (descriptor['enumerable'] == false) &&"
" (descriptor['configurable'] == false);"
"})()")->BooleanValue());
+ CHECK_EQ(42, CompileRun("func4.prototype.x")->Int32Value());
}
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698