OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <meta charset="utf-8"> | |
5 <title>XMLHttpRequest: setRequestHeader() value argument checks</title> | |
6 <script src="../resources/testharness.js"></script> | |
7 <script src="../resources/testharnessreport.js"></script> | |
8 <!-- Test based on http://w3c-test.org/web-platform-tests/master/XMLHttpRequ est/setrequestheader-bogus-value.htm This test should be removed once wpt XMLHtt pRequest is imported if both tests are in sync --> | |
9 </head> | |
10 <body> | |
11 <div id="log"> | |
12 <script type="text/javascript"> | |
13 function try_value(value, expectError) { | |
14 test(function() { | |
15 var client = new XMLHttpRequest(); | |
16 client.open("GET", "..."); | |
17 if (expectError) | |
18 assert_throws("SyntaxError", function() { client.setRequestHeade r("x-test", value) }, ' given value ' + value+', '); | |
tyoshino (SeeGerritForStatus)
2015/03/24 11:43:12
I know that this was just copied from W3C, but let
shiva.jm
2015/04/14 04:55:42
Done.
| |
19 else | |
20 client.setRequestHeader("x-test", value); | |
21 }) | |
22 } | |
23 | |
24 try_value("t\rt", true); | |
25 try_value("t\nt", true); | |
26 try_value("�ス�", true); | |
hiroshige
2015/03/20 08:54:52
This test fails on trybots (i.e. no exception is t
shiva.jm
2015/03/23 05:21:24
Yes right, in my local linux machine, these test p
| |
27 try_value("t\bt", true); | |
28 try_value("t\vt", true); | |
29 try_value("t\tt", false); | |
30 try_value("t t", false); | |
31 try_value(" t", true); | |
32 try_value("t ", true); | |
33 try_value("\xd0\xa1", false); | |
34 try_value("\x7f", true); | |
35 | |
36 test(function() { | |
37 var client = new XMLHttpRequest() | |
38 client.open("GET", "...") | |
39 assert_throws({name:'TypeError'}, function() { client.setRequestHeader(" x-test") }) | |
40 }) | |
41 | |
42 </script> | |
43 </body> | |
44 </html> | |
OLD | NEW |