WebCore:
[WebKit-https.git] / LayoutTests / http / tests / xmlhttprequest / access-control-basic-denied-preflight-cache.html
1 <html>
2 <body>
3 <p>Test async xhr preflight cache denial.  If this test passes, there should be a single PASS below.</p>
4 <script>
5     if (window.layoutTestController) {
6         layoutTestController.dumpAsText();
7         layoutTestController.waitUntilDone();
8     }
9
10     var console_messages = document.createElement("ul");
11     document.body.appendChild(console_messages);
12
13     function log(message)
14     {
15         var item = document.createElement("li");
16         item.appendChild(document.createTextNode(message));
17         console_messages.appendChild(item);
18     }
19
20     xhr = new XMLHttpRequest;
21     xhr.onreadystatechange = processStateChange;
22     try {
23         xhr.open("FOO", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi");
24         xhr.send();
25     } catch (e) {
26         log("Got exception.");
27     }
28
29     function processStateChange() {
30         if (xhr.readyState == 1) {
31             log("PASS");
32             if (window.layoutTestController)
33                 layoutTestController.notifyDone();
34         }
35     }
36 </script>
37 </body>
38 </html>