mirror of
https://github.com/nodejs/node.git
synced 2026-11-15 10:36:53 -05:00
PR-URL: https://github.com/nodejs/node/pull/60497 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
19 lines
663 B
JavaScript
19 lines
663 B
JavaScript
// Flags: --enable-sharedarraybuffer-per-context --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { isSharedArrayBuffer } = require('util/types');
|
|
const { constructSharedArrayBuffer } = require('internal/util');
|
|
|
|
// We're testing that we can construct a SAB even when the global is not exposed.
|
|
assert.strictEqual(typeof SharedArrayBuffer, 'undefined');
|
|
|
|
for (const length of [undefined, 0, 1, 2 ** 32]) {
|
|
assert(isSharedArrayBuffer(constructSharedArrayBuffer(length)));
|
|
}
|
|
|
|
for (const length of [-1, Number.MAX_SAFE_INTEGER + 1, 2 ** 64]) {
|
|
assert.throws(() => constructSharedArrayBuffer(length), RangeError);
|
|
}
|