commit-queue@webkit.org | 6a003fd | 2014-10-14 17:10:24 +0000 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <body> |
| 4 | <script> |
| 5 | if (window.testRunner) { |
| 6 | testRunner.dumpAsText(); |
| 7 | testRunner.waitUntilDone(); |
| 8 | } |
| 9 | |
| 10 | function log(str) |
| 11 | { |
| 12 | document.body.appendChild(document.createTextNode(str)); |
| 13 | document.body.appendChild(document.createElement("br")); |
| 14 | } |
| 15 | |
| 16 | function addElement(e) |
| 17 | { |
| 18 | var txt = (e && e.type) || "insertedText"; |
| 19 | log(txt); |
| 20 | } |
| 21 | document.addEventListener("DOMContentLoaded", addElement, false); |
| 22 | |
| 23 | var abortDispatched = false; |
| 24 | function reportResult() |
| 25 | { |
| 26 | log(abortDispatched ? "PASS" : "FAIL"); |
| 27 | testRunner.notifyDone(); |
| 28 | } |
| 29 | |
| 30 | window.onload = function () { |
| 31 | xhr.open("GET", "", true); |
| 32 | setTimeout(reportResult, 100); |
| 33 | }; |
| 34 | |
| 35 | var xhr = new XMLHttpRequest(); |
| 36 | xhr.onabort = function () { |
| 37 | abortDispatched = true; |
| 38 | }; |
| 39 | |
| 40 | function sendAndAbort() |
| 41 | { |
| 42 | xhr.open("GET", "", true); |
| 43 | xhr.send(); |
| 44 | xhr.abort(); |
| 45 | } |
| 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> |