blob: 1fda2bfc9fe833c649b2940550c4a255501c1191 [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', '/');
openAndSendCrossOriginSimpleXHRExpectingRedirect();
}
function openAndSendCrossOriginSimpleXHRExpectingRedirect() {
xhr.open('GET', 'http://localhost:8000/xmlhttprequest/resources/redirect.php?url=/');
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;
}
openAndSendCrossOriginSimpleXHRExpectingRedirect();
});
openAndSendCrossOriginSimpleXHRExpectingRedirect();
}, 'XMLHttpRequest doesn\'t crash even when open() is invoked synchronously' +
'to handling of a redirect response to a cross-origin request.');
</script>