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