Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / reentrant-cancel.html
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 window.onload = addElement;
23
24 var xhr = new XMLHttpRequest;
25 function sendXHR()
26 {
27     xhr.open("GET", "", true);
28     xhr.onreadystatechange = function() {
29         if (xhr.readyState != 4)
30             return;
31         if (window.testRunner)
32             testRunner.notifyDone();
33     };
34     xhr.send();
35 }
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>
43