Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index a043b364992dfd953eb2990f94c2a15e1af2c3ac..599bb7427376ab8faefd9c2489c04b601cd70bdd 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -117,6 +117,11 @@ static void IncrementingSignatureCallback( |
} |
+static void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+ info.GetReturnValue().Set(42); |
+} |
+ |
+ |
// Tests that call v8::V8::Dispose() cannot be threaded. |
UNINITIALIZED_TEST(InitializeAndDisposeOnce) { |
CHECK(v8::V8::Initialize()); |
@@ -2225,6 +2230,33 @@ THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) { |
} |
+THREADED_TEST(EmptyInterceptorDoesNotShadowApiAccessors) { |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); |
+ auto returns_42 = FunctionTemplate::New(isolate, Returns42); |
+ parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42); |
+ Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); |
+ child->Inherit(parent); |
+ AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); |
+ LocalContext env; |
+ env->Global()->Set(v8_str("Child"), child->GetFunction()); |
+ CompileRun( |
+ "var child = new Child;" |
+ "var parent = child.__proto__;"); |
+ ExpectBoolean("child.hasOwnProperty('age')", false); |
+ ExpectInt32("child.age", 42); |
+ // Check interceptor followup. |
+ ExpectInt32( |
+ "var result;" |
+ "for (var i = 0; i < 4; ++i) {" |
+ " result = child.age;" |
+ "}" |
+ "result", |
+ 42); |
+} |
+ |
+ |
THREADED_TEST(EmptyInterceptorDoesNotAffectJSProperties) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope scope(isolate); |
@@ -23456,11 +23488,6 @@ TEST(FunctionCallOptimization) { |
} |
-static void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) { |
- info.GetReturnValue().Set(42); |
-} |
- |
- |
TEST(FunctionCallOptimizationMultipleArgs) { |
i::FLAG_allow_natives_syntax = true; |
LocalContext context; |