From 1e36360233e5abb51a6db0ab67f903adb7eb1975 Mon Sep 17 00:00:00 2001 From: Balakrishna Avulapati Date: Fri, 5 Jun 2026 20:35:19 +0530 Subject: [PATCH] move dataviewSharedArrayBuffer gate out of experimentalFeatures Signed-off-by: Balakrishna Avulapati --- eslint.config.js | 1 + implementors/node/features.js | 9 +++++++-- .../test_dataview/test_sharedarraybuffer.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 4fdc8be..acb8ac2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -102,6 +102,7 @@ export default defineConfig([ gc: 'readonly', gcUntil: 'readonly', experimentalFeatures: 'readonly', + runtimeFeatures: 'readonly', onUncaughtException: 'readonly', napiVersion: 'readonly', skipTest: 'readonly', diff --git a/implementors/node/features.js b/implementors/node/features.js index f72abb7..ba8126d 100644 --- a/implementors/node/features.js +++ b/implementors/node/features.js @@ -1,9 +1,10 @@ -// Declares which experimental Node-API features this runtime supports. -// Each key corresponds to a NODE_API_EXPERIMENTAL_HAS_* compile-time macro. +// Declares which Node-API features this runtime supports, for tests to gate on. // Other implementors should set unsupported features to false or omit them. const [major, minor, patch] = process.version.slice(1).split('.').map(Number); +// Experimental features behind the NAPI_EXPERIMENTAL define. Each key +// corresponds to a NODE_API_EXPERIMENTAL_HAS_* compile-time macro. globalThis.experimentalFeatures = { // node_api_is_sharedarraybuffer and node_api_create_sharedarraybuffer were // added in Node.js v24.9.0. Earlier versions do not export these symbols, @@ -12,6 +13,10 @@ globalThis.experimentalFeatures = { createObjectWithProperties: true, setPrototype: true, postFinalizer: true, +}; + +// Version-dependent behaviors of stable (non-experimental) Node-API. +globalThis.runtimeFeatures = { // napi_create_dataview accepts a SharedArrayBuffer-backed buffer only since // Node.js v24.13.1 and v25.4.0 (nodejs/node#60473). It was not backported to // v20.x or v22.x, where such calls fail with "invalid argument". diff --git a/tests/js-native-api/test_dataview/test_sharedarraybuffer.js b/tests/js-native-api/test_dataview/test_sharedarraybuffer.js index 574bbdb..a823951 100644 --- a/tests/js-native-api/test_dataview/test_sharedarraybuffer.js +++ b/tests/js-native-api/test_dataview/test_sharedarraybuffer.js @@ -2,7 +2,7 @@ // napi_create_dataview accepts a SharedArrayBuffer-backed buffer only on newer // Node.js releases (see implementors/node/features.js). -if (!experimentalFeatures.dataviewSharedArrayBuffer) { +if (!runtimeFeatures.dataviewSharedArrayBuffer) { skipTest(); }