<html>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<body>
<script>

window.onload = function() {
    var xhr = new XMLHttpRequest();
    xhr.onload = function() {
        alert("PASS: load was not blocked");
    };

    var testIsFinished = false;
    xhr.onloadend = function() {
        testIsFinished = true;
        alert("PASS: onloadend called");
        if (window.testRunner)
            testRunner.notifyDone();
    }

    try {
        xhr.open("GET", "http://127.0.0.1:8443/");
    } catch (ex) {
        // Firefox raises an exception, which is one way to make this detectable.
        if (window.testRunner)
            testRunner.notifyDone();
    }

    // When running in normal environment, let's notify user if something went wrong
    if (!window.testRunner) {
        setTimeout(() => {
            if (testIsFinished)
                return;
            alert("Test timed out");
        }, 2000);
    }

    xhr.send(null);
};
</script>

</body>
</html>
