From 0b6210cd37b68b94252cb798598b12974a20e1c1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 21 May 2024 22:56:19 +0200 Subject: Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3. Signed-off-by: Daniel Baumann --- .../tests/xhr/send-data-sharedarraybuffer.any.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/wpt/tests/xhr/send-data-sharedarraybuffer.any.js (limited to 'test/wpt/tests/xhr/send-data-sharedarraybuffer.any.js') diff --git a/test/wpt/tests/xhr/send-data-sharedarraybuffer.any.js b/test/wpt/tests/xhr/send-data-sharedarraybuffer.any.js new file mode 100644 index 0000000..79774c3 --- /dev/null +++ b/test/wpt/tests/xhr/send-data-sharedarraybuffer.any.js @@ -0,0 +1,27 @@ +// META: title=XMLHttpRequest.send(sharedarraybuffer) + +test(() => { + const xhr = new XMLHttpRequest(); + // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()` + const buf = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer; + + xhr.open("POST", "./resources/content.py", true); + assert_throws_js(TypeError, function() { + xhr.send(buf) + }); +}, "sending a SharedArrayBuffer"); + +["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", + "Int32Array", "Uint32Array", "BigInt64Array", "BigUint64Array", + "Float32Array", "Float64Array", "DataView"].forEach((type) => { + test(() => { + const xhr = new XMLHttpRequest(); + // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()` + const arr = new self[type](new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer); + + xhr.open("POST", "./resources/content.py", true); + assert_throws_js(TypeError, function() { + xhr.send(arr) + }); + }, `sending a ${type} backed by a SharedArrayBuffer`); +}); -- cgit v1.2.3