<script>
let xhrExceptionCount = 0;

function doSyncXHR(i)
{
    try {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", "xmlhttprequest-responsetype-json.json?" + i, false);
        xhr.send(null);
    } catch(e) {
        xhrExceptionCount++;
        return false;
    }
    return true;
}

onunload = () => {
    for (let i = 0; i < 5; i++)
        doSyncXHR(i);
    top.frameDidUnload(xhrExceptionCount);
}
</script>
