summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js')
-rw-r--r--testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js b/testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js
new file mode 100644
index 0000000000..79774c3d30
--- /dev/null
+++ b/testing/web-platform/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`);
+});