From cd80fb7e5c7bed70e0a772696d85255837c8721e Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 3 Apr 2022 06:57:33 +0800 Subject: [PATCH] test: pass data into napi_create_external 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: https://github.com/nodejs/node/pull/42532 Refs: https://github.com/nodejs/node/pull/42115 Reviewed-By: Rich Trott Reviewed-By: Antoine du Hamel --- test/js-native-api/test_exception/test_exception.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/js-native-api/test_exception/test_exception.c b/test/js-native-api/test_exception/test_exception.c index 844f4475ac4d4c..053f048466d930 100644 --- a/test/js-native-api/test_exception/test_exception.c +++ b/test/js-native-api/test_exception/test_exception.c @@ -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; @@ -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; }