Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!doctype html>
2 <html>
3 <head>
4 <title>XMLHttpRequest: setRequestHeader() with invalid arguments</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <div id="log"></div>
10 <!--
11 CHAR = <any US-ASCII character (octets 0 - 127)>
12 CTL = <any US-ASCII control character
13 (octets 0 - 31) and DEL (127)>
14 SP = <US-ASCII SP, space (32)>
15 HT = <US-ASCII HT, horizontal-tab (9)>
16 token = 1*<any CHAR except CTLs or separators>
17 separators = "(" | ")" | "<" | ">" | "@"
18 | "," | ";" | ":" | "\" | <">
19 | "/" | "[" | "]" | "?" | "="
20 | "{" | "}" | SP | HT
21 field-name = token
22 -->
23 <script>
24 var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
25 "\"", "/", "[", "]", "?", "=", "{", "}", " ",
26 "\u0009", "\u007f"]
27 for (var i = 0; i < 32; ++i) {
28 invalid_headers.push(String.fromCharCode(i))
29 }
30 for (var i = 0; i < invalid_headers.length; ++i) {
31 test(function() {
32 assert_throws("SYNTAX_ERR", function() {
33 var client = new XMLHttpRequest()
34 client.open("GET", "../resources/delay.php?ms=0")
35 client.setRequestHeader(invalid_headers[i], "test")
36 }, "setRequestHeader should throw with header " +
37 format_value(invalid_headers[i]) +".")
38 })
39 }
40 </script>
41 </body>
42 </html>