Skip to content

Commit

Permalink
test: pass data into napi_create_external
Browse files Browse the repository at this point in the history
Since v8 10.1 v8::External::New DCHECKs that the data passed
into it cannot be a nullptr because that's not serializable
as external references. This updates the test to pass a
dummy data pointer to the call - which does not matter for the
test since we only care about whether the finalizer is
called.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/3513234

PR-URL: #42532
Refs: #42115
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
joyeecheung authored and juanarbol committed May 31, 2022
1 parent 7bf8117 commit 1fd1340
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/js-native-api/test_exception/test_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "../common.h"

static bool exceptionWasPending = false;
static int num = 0x23432;

static napi_value returnException(napi_env env, napi_callback_info info) {
size_t argc = 1;
Expand Down Expand Up @@ -83,7 +84,7 @@ static napi_value createExternal(napi_env env, napi_callback_info info) {
napi_value external;

NODE_API_CALL(env,
napi_create_external(env, NULL, finalizer, NULL, &external));
napi_create_external(env, &num, finalizer, NULL, &external));

return external;
}
Expand Down

0 comments on commit 1fd1340

Please sign in to comment.