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()); |
+ } |
+} |