| OLD | NEW |
| 1 if (self.importScripts) | 1 if (self.importScripts) |
| 2 importScripts("/js-test-resources/js-test.js"); | 2 importScripts("/js-test-resources/js-test.js"); |
| 3 | 3 |
| 4 self.jsTestIsAsync = true; | 4 self.jsTestIsAsync = true; |
| 5 | 5 |
| 6 description("Test cross-origin XHRs to CORS-unsupported protocol schemes in the
URL."); | 6 description("Test cross-origin XHRs to CORS-unsupported protocol schemes in the
URL."); |
| 7 | 7 |
| 8 var xhr; | 8 var xhr; |
| 9 var errorEvent; | 9 var errorEvent; |
| 10 function issueRequest(url, contentType) | 10 function issueRequest(url, contentType) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 setTimeout(runTest, 0); | 32 setTimeout(runTest, 0); |
| 33 }; | 33 }; |
| 34 // Assumed a Content-Type that turns it into a non-simple CORS request. | 34 // Assumed a Content-Type that turns it into a non-simple CORS request. |
| 35 if (contentType) | 35 if (contentType) |
| 36 xhr.setRequestHeader('Content-Type', contentType); | 36 xhr.setRequestHeader('Content-Type', contentType); |
| 37 | 37 |
| 38 shouldNotThrow('xhr.send()'); | 38 shouldNotThrow('xhr.send()'); |
| 39 } | 39 } |
| 40 | 40 |
| 41 var withContentType = true; | 41 var withContentType = true; |
| 42 var tests = [ 'http://localhost:1291a/', | 42 var tests = [ 'ftp://127.0.0.1', |
| 43 'ftp://127.0.0.1', | |
| 44 'localhost:8080/', | 43 'localhost:8080/', |
| 45 'tel:1234' ]; | 44 'tel:1234' ]; |
| 46 | 45 |
| 47 function runTest() | 46 function runTest() |
| 48 { | 47 { |
| 49 if (!tests.length && withContentType) { | 48 if (!tests.length && withContentType) { |
| 50 finishJSTest(); | 49 finishJSTest(); |
| 51 return; | 50 return; |
| 52 } | 51 } |
| 53 withContentType = !withContentType; | 52 withContentType = !withContentType; |
| 54 if (!withContentType) | 53 if (!withContentType) |
| 55 issueRequest(tests[0]); | 54 issueRequest(tests[0]); |
| 56 else | 55 else |
| 57 issueRequest(tests.shift(), 'application/json'); | 56 issueRequest(tests.shift(), 'application/json'); |
| 58 } | 57 } |
| 59 runTest(); | 58 runTest(); |
| OLD | NEW |