MCPcopy Index your code
hub / github.com/nodejs/node / validateAllowGrowableSharedArrayBuffer

Function validateAllowGrowableSharedArrayBuffer

lib/internal/webidl.js:899–912  ·  view source on GitHub ↗

* Validates the [AllowResizable] constraint for growable SharedArrayBuffer. * @param {SharedArrayBuffer} buffer SharedArrayBuffer backing buffer. * @param {ConversionOptions} options Conversion options. * @returns {void}

(buffer, options)

Source from the content-addressed store, hash-verified

897 * @returns {void}
898 */
899function validateAllowGrowableSharedArrayBuffer(buffer, options) {
900 // SharedArrayBuffer and ArrayBufferView conversion step 3:
901 // IsFixedLengthArrayBuffer(buffer) must be true without [AllowResizable].
902 // Do not use a primordial getter here. When this module is included in the
903 // startup snapshot, an early-captured SharedArrayBuffer.prototype.growable
904 // getter does not detect growable buffers created after deserialization.
905 // Lazily capturing the getter would work, but it would observe the runtime
906 // prototype at first comparison, so it would not be an actual primordial.
907 if (!options.allowResizable && buffer.growable) {
908 throw makeException(
909 'is backed by a growable SharedArrayBuffer, which is not allowed.',
910 options);
911 }
912}
913
914/**
915 * Validates the [AllowResizable] constraint for resizable ArrayBuffer.

Callers 2

webidl.jsFile · 0.85

Calls 1

makeExceptionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…