Skip to content

Commit 2c4ee8a

Browse files
authored
test: create HandleScope in weak callback (#887)
test: create HandleScope in weak callbacks By analogy with https://chromium.googlesource.com/v8/v8/+/8c8bd658c6f3a765a73ac49e57b7b138a67db635/test/cctest/test-api.cc#13418
1 parent 8208c55 commit 2c4ee8a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

test/cpp/weak.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static Persistent<v8::Function> cb;
1515

1616
void weakCallback(
1717
const WeakCallbackInfo<int> &data) { // NOLINT(runtime/references)
18+
HandleScope scope;
1819
int *parameter = data.GetParameter();
1920
v8::Local<v8::Value> val = New(*parameter);
2021
async_resource->runInAsyncScope(

test/cpp/weak2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ static AsyncResource* async_resource;
1414
static Persistent<v8::Function> cb;
1515
void weakCallback(
1616
const WeakCallbackInfo<int> &data) { // NOLINT(runtime/references)
17+
HandleScope scope;
1718
int *parameter = static_cast<int*>(data.GetInternalField(0));
1819
v8::Local<v8::Value> val = New(*parameter);
1920
async_resource->runInAsyncScope(

0 commit comments

Comments
 (0)