This reproduces a bug where a DataView created from the current wasm shared memory is passed back into N-API after memory.grow(), and napi_get_dataview_info(..., &arraybuffer, ...) returns the old SharedArrayBuffer instead of the current memory.buffer.
npm install
npm startAfter memory.grow(), CreateDataViewFromJSDataView(view) should rebuild the returned view against the new memory.buffer.
The last two fields should be:
{
"returnedViewUsesOldBuffer": false,
"returnedViewUsesNewBuffer": true
}With the buggy behavior, the script prints:
{
"returnedViewUsesOldBuffer": true,
"returnedViewUsesNewBuffer": false
}and exits with code 1.
dataview.wasmis a prebuilt minimal test module compiled from emnapi's existingpackages/test/dataview/binding.c.- The repro depends on the latest published
@emnapi/coreand@emnapi/runtimeversions pinned inpackage.json. - The script uses
process.reallyExit()when available to avoid unrelated wasm32 env teardown noise when finishing the repro process.