aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/xhr/send-data-sharedarraybuffer.any.js
blob: b902888f5600eaa87f481967579959c5f7137d3b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// META: title=XMLHttpRequest.send(sharedarraybuffer)

test(() => {
    var xhr = new XMLHttpRequest();
    var buf = new SharedArrayBuffer();

    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", "Float32Array", "Float64Array", "DataView"].forEach((type) => {
    test(() => {
        var xhr = new XMLHttpRequest();
        var arr = new self[type](new SharedArrayBuffer());

        xhr.open("POST", "./resources/content.py", true);
        assert_throws_js(TypeError, function() {
            xhr.send(arr)
        });
    }, `sending a ${type} backed by a SharedArrayBuffer`);
});