Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / reentrant-cancel.html
blob3b3f976cd20375b600e9ac9e5ff4a23b076fca29
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);
22 window.onload = addElement;
24 var xhr = new XMLHttpRequest;
25 function sendXHR()
27 xhr.open("GET", "", true);
28 xhr.onreadystatechange = function() {
29 if (xhr.readyState != 4)
30 return;
31 if (window.testRunner)
32 testRunner.notifyDone();
34 xhr.send();
36 window.addEventListener("DOMSubtreeModified", sendXHR);
37 addElement();
38 </script>
39 This tests that when we re-entrantly create and cancel XHRs, we don't try to disconnect the same CachedResourceClient
40 multiple times from its CachedResource. We pass if we don't crash.<br/>
41 </body>
42 </html>