src: throw RangeError on failed ArrayBuffer BackingStore allocation

This also updates `ERR_MEMORY_ALLOCATION_FAILED` to be a RangeError,
aligning with V8's OutOfMemory error type.

PR-URL: https://github.com/nodejs/node/pull/61480
Refs: https://github.com/nodejs/node/blob/c755b0113ce0cb6d83baf2cf070ba381a5673db2/deps/v8/src/builtins/builtins-typed-array.cc#L584
Refs: https://tc39.es/ecma262/#sec-sharedarraybuffer.prototype.grow
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Chengzhong Wu authored and GitHub committed 2026-01-25 15:18:45 +00:00
1 parent 680ee6ee66
commit 3fed9fbc0b
4 files changed
+53 -15

No files matched your search

+1 -1
View File
@@ -106,7 +106,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
V(ERR_INVALID_URL_PATTERN, TypeError) \
V(ERR_INVALID_URL_SCHEME, TypeError) \
V(ERR_LOAD_SQLITE_EXTENSION, Error) \
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
V(ERR_MEMORY_ALLOCATION_FAILED, RangeError) \
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \
V(ERR_MISSING_ARGS, TypeError) \
V(ERR_MISSING_PASSPHRASE, TypeError) \