mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
lib: reject SharedArrayBuffer in Blob constructor per spec
Signed-off-by: Ali Hassan <ali-hassan27@outlook.com> PR-URL: https://github.com/nodejs/node/pull/63046 Refs: https://github.com/nodejs/node/issues/59688 Refs: https://github.com/nodejs/node/pull/62632 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
59272da055
commit
9390c810d1
2 files changed
+32
-2
No files matched your search
@@ -3,6 +3,7 @@
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const test = require('node:test');
|
||||
const { Blob } = require('buffer');
|
||||
const { ReadableStream } = require('stream/web');
|
||||
|
||||
const sab = new SharedArrayBuffer(8);
|
||||
@@ -98,6 +99,29 @@ test('ReadableByteStreamController.enqueue() rejects SAB-backed DataView', async
|
||||
reader.releaseLock();
|
||||
});
|
||||
|
||||
// -- Blob --
|
||||
|
||||
test('Blob rejects SharedArrayBuffer part', () => {
|
||||
assert.throws(
|
||||
() => new Blob([sab]),
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' },
|
||||
);
|
||||
});
|
||||
|
||||
test('Blob rejects SAB-backed Uint8Array part', () => {
|
||||
assert.throws(
|
||||
() => new Blob([sabView]),
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' },
|
||||
);
|
||||
});
|
||||
|
||||
test('Blob rejects SAB-backed DataView part', () => {
|
||||
assert.throws(
|
||||
() => new Blob([sabDataView]),
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' },
|
||||
);
|
||||
});
|
||||
|
||||
// -- SharedWebIDL converters --
|
||||
|
||||
const { converters } = require('internal/webidl');
|
||||
|
||||
Reference in new issue
Block a user