Tests/LibWeb: Verify XHR.send() throws when called twice

This verifies that XHR.send() throws an Invalid State Error when called
twice.
This commit is contained in:
Kenneth Myhra 2023-11-25 14:47:08 +01:00 committed by Andreas Kling
commit ff05f19c84
Notes: sideshowbarker 2024-07-16 18:26:46 +09:00
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,16 @@
<script src="../include.js"></script>
<script>
test(() => {
const INVALID_STATE_ERR = 11;
try {
const xhr = new XMLHttpRequest();
xhr.open("GET", "data:text/plain,", true);
xhr.send();
xhr.send();
}
catch (e) {
if (e.code === INVALID_STATE_ERR)
println("PASS");
}
});
</script>