From c7e2617419a889b1e4b610ee395341ef87dc3aed Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Mon, 14 Sep 2020 17:20:57 -0700 Subject: [PATCH 1/2] n-api: create N-API version 7 Mark `napi_detach_arraybuffer` and `napi_is_detached_arraybuffer` as stable. --- doc/api/n-api.md | 6 ++---- src/js_native_api.h | 5 ++++- test/js-native-api/test_typedarray/test_typedarray.c | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index db43ee18affaf4..3f5b603ac67273 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3538,10 +3538,9 @@ added: - v13.0.0 - v12.16.0 - v10.22.0 +napiVersion: 7 --> -> Stability: 1 - Experimental - ```c napi_status napi_detach_arraybuffer(napi_env env, napi_value arraybuffer) @@ -3567,10 +3566,9 @@ added: - v13.3.0 - v12.16.0 - v10.22.0 +napiVersion: 7 --> -> Stability: 1 - Experimental - ```c napi_status napi_is_detached_arraybuffer(napi_env env, napi_value arraybuffer, diff --git a/src/js_native_api.h b/src/js_native_api.h index d0d975c2b454a8..00c9811947e206 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -529,7 +529,7 @@ NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, void** data); #endif // NAPI_VERSION >= 6 -#ifdef NAPI_EXPERIMENTAL +#if NAPI_VERSION >= 7 // ArrayBuffer detaching NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, napi_value arraybuffer); @@ -537,6 +537,9 @@ NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env, napi_value value, bool* result); +#endif // NAPI_VERSION >= 7 + +#ifdef NAPI_EXPERIMENTAL // Type tagging NAPI_EXTERN napi_status napi_type_tag_object(napi_env env, napi_value value, diff --git a/test/js-native-api/test_typedarray/test_typedarray.c b/test/js-native-api/test_typedarray/test_typedarray.c index 66b1f9019c04ea..1714b5fe717f87 100644 --- a/test/js-native-api/test_typedarray/test_typedarray.c +++ b/test/js-native-api/test_typedarray/test_typedarray.c @@ -1,4 +1,3 @@ -#define NAPI_EXPERIMENTAL #include #include #include From bf66a6aeed25d0f355dc668f1d8bb6461a21e372 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Mon, 14 Sep 2020 21:44:24 -0700 Subject: [PATCH 2/2] update definition of NAPI_VERSION --- src/js_native_api.h | 2 +- src/node_version.h | 2 +- test/js-native-api/test_general/test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js_native_api.h b/src/js_native_api.h index 00c9811947e206..bd8bd35d7b72c9 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -17,7 +17,7 @@ // functions available in a new version of N-API that is not yet ported in all // LTS versions, they can set NAPI_VERSION knowing that they have specifically // depended on that version. -#define NAPI_VERSION 6 +#define NAPI_VERSION 7 #endif #endif diff --git a/src/node_version.h b/src/node_version.h index b9670f57bde291..c6a011c618aac2 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -93,6 +93,6 @@ // The NAPI_VERSION provided by this version of the runtime. This is the version // which the Node binary being built supports. -#define NAPI_VERSION 6 +#define NAPI_VERSION 7 #endif // SRC_NODE_VERSION_H_ diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js index de06aecb590529..4dbdc37c918c37 100644 --- a/test/js-native-api/test_general/test.js +++ b/test/js-native-api/test_general/test.js @@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject), test_general.testGetPrototype(extendedObject)); // Test version management functions -assert.strictEqual(test_general.testGetVersion(), 6); +assert.strictEqual(test_general.testGetVersion(), 7); [ 123,