summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html
blob: ec88cf2002a33eda01fc76c56689357d7cabbe34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html>
<script>
function log(s)
{
    var logDiv = document.getElementById("log");
    logDiv.appendChild(document.createTextNode(s));
    logDiv.appendChild(document.createElement("br"));
}

function test()
{
    if (window.testRunner) {
        testRunner.dumpAsText();
    }
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        lastReadyStateObserved = xhr.readyState;
        if (xhr.readyState == 4) {
            try {
                xhr.open("GET", "recurse.html", false);
                xhr.send(null);
            } catch(e) {
                log("FAIL: An event listener should not throw an exception.");
            }
        }
    };
    xhr.open("GET", "recurse.html", false);
    xhr.send(null);
    log("PASS");
}
</script>
<body onload="test()">
This tests that having infinite recursion in XMLHttpRequest event handler does not crash.
<br>
<div id="log"></div>
</body>
</html>