Index: test/cctest/test-api-interceptors.cc |
diff --git a/test/cctest/test-api-interceptors.cc b/test/cctest/test-api-interceptors.cc |
index f1238620af1d970be6f69b9bcc8c7d1504b73fed..0038e9ffb04c920ae20924f9f92aab531c88eb03 100644 |
--- a/test/cctest/test-api-interceptors.cc |
+++ b/test/cctest/test-api-interceptors.cc |
@@ -495,6 +495,12 @@ void SetterCallback(Local<Name> property, Local<Value> value, |
set_was_called_counter++; |
} |
+void InterceptingSetterCallback( |
+ Local<Name> property, Local<Value> value, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ info.GetReturnValue().Set(value); |
+} |
+ |
} // namespace |
// Check that get callback is called in defineProperty with accessor descriptor. |
@@ -596,6 +602,25 @@ THREADED_TEST(InterceptorFunctionRedeclareWithQueryCallback) { |
v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).ToLocalChecked(); |
} |
+// Regression test for chromium bug 656648. |
+// Do not crash on non-masking, intercepting setter callbacks. |
+THREADED_TEST(NonMaskingInterceptor) { |
+ v8::HandleScope scope(CcTest::isolate()); |
+ LocalContext env; |
+ v8::Local<v8::FunctionTemplate> templ = |
+ v8::FunctionTemplate::New(CcTest::isolate()); |
+ |
+ v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); |
+ object_template->SetHandler(v8::NamedPropertyHandlerConfiguration( |
+ nullptr, InterceptingSetterCallback, nullptr, nullptr, nullptr, |
+ Local<Value>(), v8::PropertyHandlerFlags::kNonMasking)); |
+ v8::Local<v8::Context> ctx = |
+ v8::Context::New(CcTest::isolate(), nullptr, object_template); |
+ |
+ v8::Local<v8::String> code = v8_str("function x() {return 43;};"); |
+ v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).ToLocalChecked(); |
+} |
+ |
// Check that function re-declarations throw if they are read-only. |
THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) { |
v8::HandleScope scope(CcTest::isolate()); |