mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,48 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>XMLHttpRequest: setRequestHeader() name argument checks</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[3]" />
|
||||
</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>
|
||||
function try_name(name) {
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "...")
|
||||
assert_throws("SyntaxError", function() { client.setRequestHeader(name, 'x-value') })
|
||||
}, "setRequestHeader should throw with header name " + format_value(invalid_headers[i]) + ".")
|
||||
}
|
||||
var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
|
||||
"\"", "/", "[", "]", "?", "=", "{", "}", " ",
|
||||
/* HT already tested in the loop below */
|
||||
"\u007f", "テスト", "", "t\rt", "t\nt", "t: t", "t:t",
|
||||
"t<t", "t t", " tt", ":tt", "\ttt", "\vtt", "t\0t",
|
||||
"t\"t", "t,t", "t;t", "()[]{}", "a?B", "X-テスト", "a=B"]
|
||||
for (var i = 0; i < 32; ++i) {
|
||||
invalid_headers.push(String.fromCharCode(i))
|
||||
}
|
||||
for (var i = 0; i < invalid_headers.length; ++i) {
|
||||
try_name(invalid_headers[i])
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue