Index: test/cctest/test-global-handles.cc |
diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc |
index 2a302c0dfb96d746a4e5335f5d2743bd73e4674d..22fd785566c9e2480bcee81948a037c6f5173f36 100644 |
--- a/test/cctest/test-global-handles.cc |
+++ b/test/cctest/test-global-handles.cc |
@@ -401,3 +401,19 @@ TEST(PersistentBaseGetLocal) { |
CHECK(o == g.Get(isolate)); |
CHECK(v8::Local<v8::Object>::New(isolate, g) == g.Get(isolate)); |
} |
+ |
+ |
+void WeakCallback(const v8::WeakCallbackInfo<void>& data) {} |
+ |
+ |
+TEST(WeakPersistentSmi) { |
+ CcTest::InitializeVM(); |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ |
+ v8::HandleScope scope(isolate); |
+ v8::Local<v8::Number> n = v8::Number::New(isolate, 0); |
+ v8::Global<v8::Number> g(isolate, n); |
+ |
+ // Should not crash. |
+ g.SetWeak<void>(nullptr, &WeakCallback, v8::WeakCallbackType::kParameter); |
+} |