OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <script src="/js-test-resources/js-test.js"></script> | |
3 <body onload="openXHR();"> | |
4 <!-- This embed is necessary to cause the synchronous invocation of onload --> | |
5 <embed type="text/html; charset=utf-8"> | |
6 <script> | |
7 window.jsTestIsAsync = true; | |
8 description('XMLHttpRequest doesn\'t crash even when open() is invoked ' + | |
9 'synchronously to handling of an invalid preflight response.'); | |
10 | |
11 var xhr = new XMLHttpRequest; | |
12 var count = 10; // The crash doesn't always happen. Repeat to capture it. | |
13 | |
14 function openXHR() { | |
15 xhr.open('GET', '/'); | |
16 openAndSendCrossOriginNonSimpleXHR(); | |
17 } | |
18 | |
19 function openAndSendCrossOriginNonSimpleXHR() { | |
20 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/"); | |
21 xhr.send(); | |
22 } | |
23 | |
24 xhr.onerror = function() { | |
25 --count; | |
26 if (count <= 0) { | |
27 setTimeout(finishJSTest, 0); | |
28 } else { | |
29 openAndSendCrossOriginNonSimpleXHR(); | |
30 } | |
31 } | |
32 | |
33 openAndSendCrossOriginNonSimpleXHR(); | |
34 </script> | |
OLD | NEW |