| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 test(() => { |
| 6 const NON_TOKEN_METHODS = [ |
| 7 '', |
| 8 'test\r\nfoobar', |
| 9 ' ', |
| 10 'A A', |
| 11 '"', |
| 12 '(', |
| 13 ')', |
| 14 ',', |
| 15 '/', |
| 16 ':', |
| 17 ';', |
| 18 '<', |
| 19 '=', |
| 20 '>', |
| 21 '?', |
| 22 '@', |
| 23 '[', |
| 24 '\\', |
| 25 ']', |
| 26 '{', |
| 27 '}' |
| 28 ]; |
| 29 |
| 30 for (let method of NON_TOKEN_METHODS) { |
| 31 const xhr = new XMLHttpRequest(); |
| 32 assert_throws('SyntaxError', () => { |
| 33 xhr.open(method, '/'); |
| 34 }, 'open() should throw for a SyntaxError for method "' + method + |
| 35 '" which does not conform to the token ABNF'); |
| 36 } |
| 37 }, 'Method strings that are not token'); |
| 38 |
| 39 test(() => { |
| 40 const FORBIDDEN_METHODS = [ |
| 41 'CONNECT', |
| 42 'connect', |
| 43 'Connect', |
| 44 'TRACE', |
| 45 'TRACK' |
| 46 ]; |
| 47 |
| 48 for (let method of FORBIDDEN_METHODS) { |
| 49 const xhr = new XMLHttpRequest(); |
| 50 assert_throws('SecurityError', () => { |
| 51 xhr.open(method, '/'); |
| 52 }, 'open() should throw a SecurityError for a forbidden method "' + method +
'"'); |
| 53 } |
| 54 }, 'Forbidden methods'); |
| 55 </script> |
| OLD | NEW |