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

Side by Side Diff: test/cctest/test-api.cc

Issue 10831388: Handle native callbacks without getters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed elements case, too. Rebased. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 2
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
(...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 for (int i = 0; i < 10; i++) { 3735 for (int i = 0; i < 10; i++) {
3736 CHECK(xValue.IsEmpty()); 3736 CHECK(xValue.IsEmpty());
3737 script->Run(); 3737 script->Run();
3738 CHECK_EQ(v8_num(4), xValue); 3738 CHECK_EQ(v8_num(4), xValue);
3739 xValue.Dispose(); 3739 xValue.Dispose();
3740 xValue = v8::Persistent<Value>(); 3740 xValue = v8::Persistent<Value>();
3741 } 3741 }
3742 } 3742 }
3743 3743
3744 3744
3745 THREADED_TEST(SetterOnly) {
3746 v8::HandleScope scope;
3747 Local<ObjectTemplate> templ = ObjectTemplate::New();
3748 templ->SetAccessor(v8_str("x"), NULL, SetXValue, v8_str("donut"));
3749 LocalContext context;
3750 context->Global()->Set(v8_str("obj"), templ->NewInstance());
3751 Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x"));
3752 for (int i = 0; i < 10; i++) {
3753 CHECK(xValue.IsEmpty());
3754 script->Run();
3755 CHECK_EQ(v8_num(4), xValue);
3756 xValue.Dispose();
3757 xValue = v8::Persistent<Value>();
3758 }
3759 }
3760
3761
3762 THREADED_TEST(NoAccessors) {
3763 v8::HandleScope scope;
3764 Local<ObjectTemplate> templ = ObjectTemplate::New();
3765 templ->SetAccessor(v8_str("x"), NULL, NULL, v8_str("donut"));
3766 LocalContext context;
3767 context->Global()->Set(v8_str("obj"), templ->NewInstance());
3768 Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x"));
3769 for (int i = 0; i < 10; i++) {
3770 script->Run();
3771 }
3772 }
3773
3774
3745 static v8::Handle<Value> XPropertyGetter(Local<String> property, 3775 static v8::Handle<Value> XPropertyGetter(Local<String> property,
3746 const AccessorInfo& info) { 3776 const AccessorInfo& info) {
3747 ApiTestFuzzer::Fuzz(); 3777 ApiTestFuzzer::Fuzz();
3748 CHECK(info.Data()->IsUndefined()); 3778 CHECK(info.Data()->IsUndefined());
3749 return property; 3779 return property;
3750 } 3780 }
3751 3781
3752 3782
3753 THREADED_TEST(NamedInterceptorPropertyRead) { 3783 THREADED_TEST(NamedInterceptorPropertyRead) {
3754 v8::HandleScope scope; 3784 v8::HandleScope scope;
(...skipping 13402 matching lines...) Expand 10 before | Expand all | Expand 10 after
17157 v8::HandleScope scope; 17187 v8::HandleScope scope;
17158 LocalContext context; 17188 LocalContext context;
17159 17189
17160 // Compile a try-finally clause where the finally block causes a GC 17190 // Compile a try-finally clause where the finally block causes a GC
17161 // while there still is a message pending for external reporting. 17191 // while there still is a message pending for external reporting.
17162 TryCatch try_catch; 17192 TryCatch try_catch;
17163 try_catch.SetVerbose(true); 17193 try_catch.SetVerbose(true);
17164 CompileRun("try { throw new Error(); } finally { gc(); }"); 17194 CompileRun("try { throw new Error(); } finally { gc(); }");
17165 CHECK(try_catch.HasCaught()); 17195 CHECK(try_catch.HasCaught());
17166 } 17196 }
OLDNEW
« 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