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

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

Issue 139263008: Fix stub-invoked setter callback handling. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 11 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/x64/stub-cache-x64.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 66ffc9a8b3679afe7be2ae8ac4167aeb2e489f89..d8f69ba198c8ebb6d7c466fa8be433edb4ff0d72 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21627,3 +21627,44 @@ TEST(EscapeableHandleScope) {
}
}
}
+
+
+static void SetterWhichExpectsThisAndHolderToDiffer(
+ Local<String>, Local<Value>, const v8::PropertyCallbackInfo<void>& info) {
+ CHECK(info.Holder() != info.This());
+}
+
+
+TEST(Regress239669) {
dcarney 2014/01/16 07:44:13 this test doesn't test the stub you changed please
sof 2014/01/16 08:00:16 Thanks, will do. (But what's there exercises that
sof 2014/01/16 08:44:11 Done.
+ // Regress618 triggers the StoreCallbackProperty() code path
+ // we're after; this is a reduced version of it.
+ const char* source = "function C1() {"
+ " this.x = 23;"
+ "};"
+ "C1.prototype = P;";
+
+ LocalContext context;
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::HandleScope scope(isolate);
+
+ // Use a simple object as prototype.
+ v8::Local<v8::Object> prototype = v8::Object::New(isolate);
+ prototype->Set(v8_str("y"), v8_num(42));
+ context->Global()->Set(v8_str("P"), prototype);
+
+ CompileRun(source);
+ v8::Local<v8::Script> script = v8::Script::Compile(v8_str("new C1();"));
+ for (int i = 0; i < 2; i++) {
+ v8::Handle<v8::Object>::Cast(script->Run());
+ }
+
+ Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+ templ->SetAccessor(v8_str("x"), 0, SetterWhichExpectsThisAndHolderToDiffer);
+ context->Global()->Set(v8_str("P"), templ->NewInstance());
+
+ CompileRun(source);
+ script = v8::Script::Compile(v8_str("new C1();"));
+ for (int i = 0; i < 2; i++) {
+ v8::Handle<v8::Object>::Cast(script->Run());
+ }
+}
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698