Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / reentrant-cancel-abort.html
blobae8cd55dbe5f544ef95efcab044b6d81e75dcf45
1 <!doctype html>
2 <html>
3 <body>
4 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
10 function log(str)
12 document.body.appendChild(document.createTextNode(str));
13 document.body.appendChild(document.createElement("br"));
16 function addElement(e)
18 var txt = (e && e.type) || "insertedText";
19 log(txt);
21 document.addEventListener("DOMContentLoaded", addElement, false);
23 var abortDispatched = false;
24 function reportResult()
26 log(abortDispatched ? "PASS" : "FAIL");
27 testRunner.notifyDone();
30 window.onload = function () {
31 xhr.open("GET", "", true);
32 setTimeout(reportResult, 100);
35 var xhr = new XMLHttpRequest();
36 xhr.onabort = function () {
37 abortDispatched = true;
40 function sendAndAbort()
42 xhr.open("GET", "", true);
43 xhr.send();
44 xhr.abort();
46 window.addEventListener("DOMSubtreeModified", sendAndAbort);
47 addElement();
48 </script>
49 Reentrancy, cancellation and explicit abort. Check that we don't crash
50 and report the expected abort event.<br/>
51 </body>
52 </html>