Skip to content

Commit

Permalink
test: create HandleScope in weak callback (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon authored Mar 3, 2020
1 parent 8208c55 commit 2c4ee8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/cpp/weak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ static Persistent<v8::Function> cb;

void weakCallback(
const WeakCallbackInfo<int> &data) { // NOLINT(runtime/references)
HandleScope scope;
int *parameter = data.GetParameter();
v8::Local<v8::Value> val = New(*parameter);
async_resource->runInAsyncScope(
Expand Down
1 change: 1 addition & 0 deletions test/cpp/weak2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ static AsyncResource* async_resource;
static Persistent<v8::Function> cb;
void weakCallback(
const WeakCallbackInfo<int> &data) { // NOLINT(runtime/references)
HandleScope scope;
int *parameter = static_cast<int*>(data.GetInternalField(0));
v8::Local<v8::Value> val = New(*parameter);
async_resource->runInAsyncScope(
Expand Down

0 comments on commit 2c4ee8a

Please sign in to comment.