diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm')
-rw-r--r-- | testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm b/testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm new file mode 100644 index 000000000..86e55f33a --- /dev/null +++ b/testing/web-platform/tests/XMLHttpRequest/setrequestheader-bogus-name.htm @@ -0,0 +1,59 @@ +<!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]) + ".") + } + function try_byte_string(name) { + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "...") + assert_throws(new TypeError(), function() { client.setRequestHeader(name, 'x-value') }) + }, "setRequestHeader should throw with header name " + format_value(invalid_byte_strings[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", "a=B"] + var invalid_byte_strings = ["テスト", "X-テスト"] + 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]) + } + for (var i = 0; i < invalid_byte_strings.length; ++i) { + try_byte_string(invalid_byte_strings[i]) + } + + </script> + </body> +</html> |