mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
dda86cd70e
--HG-- extra : rebase_source : d635a4f39c587d4d381b486dd63de747865b77a2
44 lines
1.7 KiB
HTML
44 lines
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>XMLHttpRequest: setRequestHeader() with invalid arguments</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="log"></div>
|
|
<!--
|
|
CHAR = <any US-ASCII character (octets 0 - 127)>
|
|
CTL = <any US-ASCII control character
|
|
(octets 0 - 31) and DEL (127)>
|
|
SP = <US-ASCII SP, space (32)>
|
|
HT = <US-ASCII HT, horizontal-tab (9)>
|
|
token = 1*<any CHAR except CTLs or separators>
|
|
separators = "(" | ")" | "<" | ">" | "@"
|
|
| "," | ";" | ":" | "\" | <">
|
|
| "/" | "[" | "]" | "?" | "="
|
|
| "{" | "}" | SP | HT
|
|
field-name = token
|
|
-->
|
|
<script>
|
|
var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
|
|
"\"", "/", "[", "]", "?", "=", "{", "}", " ",
|
|
/* HT already tested in the loop below */
|
|
"\u007f"]
|
|
for (var i = 0; i < 32; ++i) {
|
|
invalid_headers.push(String.fromCharCode(i))
|
|
}
|
|
for (var i = 0; i < invalid_headers.length; ++i) {
|
|
test(function() {
|
|
assert_throws("SyntaxError", function() {
|
|
var client = new XMLHttpRequest()
|
|
client.open("GET", "../common/text-plain.txt")
|
|
client.setRequestHeader(invalid_headers[i], "test")
|
|
})
|
|
}, "setRequestHeader should throw with header " +
|
|
format_value(invalid_headers[i]) + ".")
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|