1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

Tests/LibWeb: Verify XHR.send() throws when XHR.readyState is UNSENT

This verifies that an Invalid State Error is being thrown when
XHR.open() has not been called before calling XHR::send().
This commit is contained in:
Kenneth Myhra 2023-11-25 14:27:30 +01:00 committed by Andreas Kling
parent 7a0191cbe9
commit ac82585ae7
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1 @@
PASS

View file

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