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

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

Issue 2675993002: [runtime] Fix use of attributes if intercepted. (Closed)
Patch Set: Created 3 years, 10 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/runtime/runtime-scopes.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-interceptors.cc
diff --git a/test/cctest/test-api-interceptors.cc b/test/cctest/test-api-interceptors.cc
index 96c2c454a9e23d2bff7966e5bf5762c460f9caa4..f1238620af1d970be6f69b9bcc8c7d1504b73fed 100644
--- a/test/cctest/test-api-interceptors.cc
+++ b/test/cctest/test-api-interceptors.cc
@@ -568,6 +568,34 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) {
CHECK_EQ(set_was_called_counter, 3);
}
+namespace {
+void QueryCallbackSetDontDelete(
+ Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ info.GetReturnValue().Set(v8::PropertyAttribute::DontDelete);
+}
+
+} // namespace
+
+// Regression for a Node.js test that fails in debug mode.
+THREADED_TEST(InterceptorFunctionRedeclareWithQueryCallback) {
+ 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, nullptr, QueryCallbackSetDontDelete));
+ v8::Local<v8::Context> ctx =
+ v8::Context::New(CcTest::isolate(), nullptr, object_template);
+
+ // Declare and redeclare function.
+ v8::Local<v8::String> code = v8_str(
+ "function x() {return 42;};"
+ "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());
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698