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 a response to a cross-origin ' + | |
10 'request.'); | |
11 | |
12 var xhr = new XMLHttpRequest; | |
13 var count = 10; // The crash doesn't always happen. Repeat to capture it. | |
14 | |
15 function openXHR() { | |
16 xhr.open('GET', '/'); | |
17 openAndSendCrossOriginSimpleXHR(); | |
18 } | |
19 | |
20 function openAndSendCrossOriginSimpleXHR() { | |
21 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/test.html"); | |
22 xhr.send(); | |
23 } | |
24 | |
25 xhr.onerror = function() { | |
26 --count; | |
27 if (count <= 0) { | |
28 setTimeout(finishJSTest, 0); | |
29 } else { | |
30 openAndSendCrossOriginSimpleXHR(); | |
31 } | |
32 } | |
33 | |
34 openAndSendCrossOriginSimpleXHR(); | |
35 </script> | |
OLD | NEW |