1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 20:17:34 +00:00

Tests/LibWeb: Verify XHR.response is an instance of ArrayBuffer

This verifies that XHR.response is an instance of ArrayBuffer when
XHR.responseType is set to 'arraybuffer'.
This commit is contained in:
Kenneth Myhra 2023-11-27 20:28:46 +01:00 committed by Andreas Kling
parent 68fa8f52b4
commit 990f73708d
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,18 @@
<script src="../include.js"></script>
<script>
asyncTest((done) => {
const xhr = new XMLHttpRequest();
xhr.responseType = "arraybuffer";
xhr.onreadystatechange = async function() {
if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.response instanceof ArrayBuffer)
println("PASS");
else
println("FAIL");
done();
}
};
xhr.open("GET", "data:text/plain,Hello%20World!", true);
xhr.send();
});
</script>