Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <script> | |
| 5 async_test(t => { | |
| 6 const xhr = new XMLHttpRequest(); | |
| 7 xhr.open('GET', 'resources/get.txt'); | |
| 8 xhr.onload = t.step_func(() => { | |
| 9 assert_equals(xhr.responseText, 'PASS'); | |
| 10 t.done(); | |
| 11 }); | |
| 12 | |
| 13 assert_throws('SyntaxError', () => { | |
| 14 xhr.open('FOO BAR', 'nonexistent'); | |
| 15 }, 'open() should throw for a SyntaxError for an invalid method'); | |
| 16 | |
| 17 xhr.send(); | |
| 18 }, 'open() with an invalid method is no-op'); | |
| 19 | |
| 20 async_test(t => { | |
| 21 const xhr = new XMLHttpRequest(); | |
| 22 xhr.open('GET', 'resources/get.txt'); | |
| 23 xhr.onload = t.step_func(() => { | |
| 24 assert_equals(xhr.responseText, 'PASS'); | |
| 25 t.done(); | |
| 26 }); | |
| 27 | |
| 28 assert_throws('SecurityError', () => { | |
| 29 xhr.open('CONNECT', 'nonexistent'); | |
| 30 }, 'open() should throw for a SecurityError for a forbidden method'); | |
| 31 | |
| 32 xhr.send(); | |
| 33 }, 'open() with a forbidden method is no-op'); | |
| 34 | |
| 35 async_test(t => { | |
| 36 const xhr = new XMLHttpRequest(); | |
| 37 xhr.open('GET', 'resources/get.txt'); | |
| 38 xhr.onload = t.step_func(() => { | |
| 39 assert_equals(xhr.responseText, 'PASS'); | |
| 40 t.done(); | |
| 41 }); | |
| 42 | |
| 43 assert_throws('SyntaxError', () => { | |
| 44 xhr.open('GET', 'http://localhost:foobar/'); | |
| 45 }, 'open() should throw for a SyntaxError for an invalid method'); | |
|
yhirano
2016/09/01 07:02:42
wrong description
tyoshino (SeeGerritForStatus)
2016/09/01 10:19:41
Good catches. Fixed
| |
| 46 | |
| 47 xhr.send(); | |
| 48 }, 'open() with a forbidden method is no-op'); | |
|
yhirano
2016/09/01 07:02:42
wrong name
tyoshino (SeeGerritForStatus)
2016/09/01 10:19:41
Done.
| |
| 49 </script> | |
| OLD | NEW |