mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
Tests/LibWeb: Verify XHR.open() throws on illegal token in method arg
This verifies that XHR.open() throws a Syntax Error if an illegal token is passed to the method argument.
This commit is contained in:
parent
ff05f19c84
commit
eb6a7ccc59
2 changed files with 21 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const SYNTAX_ERR = 12;
|
||||||
|
const illegalTokens = "\"(),/:;<=>?@[\\]{}";
|
||||||
|
let i = 0;
|
||||||
|
for (const token of illegalTokens) {
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
try {
|
||||||
|
xhr.open(token, "data:text/plain,", true);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e.code === SYNTAX_ERR)
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i === illegalTokens.length)
|
||||||
|
println("PASS");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue