blob: 48b5539b06638c1b3c29d2e895f0e6889c53158d [file] [log] [blame]
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body onload="openXHR();">
<!-- This embed is necessary to cause the synchronous invocation of onload -->
<embed type="text/html; charset=utf-8">
<script>
const xhr = new XMLHttpRequest();
function openXHR() {
xhr.open('GET', '/');
openAndSendCrossOriginSimpleXHR();
}
function openAndSendCrossOriginSimpleXHR() {
xhr.open('GET', 'http://localhost:8000/xmlhttprequest/resources/test.html');
xhr.send();
}
async_test((test) => {
// The crash doesn't always happen. Repeat to capture it.
let count = 10;
xhr.onerror = test.step_func(() => {
--count;
if (count <= 0) {
test.done();
return;
}
openAndSendCrossOriginSimpleXHR();
});
openAndSendCrossOriginSimpleXHR();
}, 'XMLHttpRequest doesn\'t crash even when open() is invoked ' +
'synchronously to handling of a response to a cross-origin request.');
openAndSendCrossOriginSimpleXHR();
</script>