Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / access-control-basic-allow-preflight-cache.html
blobf3ec714d3477ab2a23828de55a800d713d5f768f
1 <html>
2 <body>
3 <pre id='console'></pre>
4 <script type="text/javascript">
5 function log(message)
7 document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
10 if (window.testRunner) {
11 testRunner.dumpAsText();
12 testRunner.waitUntilDone();
15 function errorHandler(event)
17 log("FAIL: Network error. ");
18 if (window.testRunner)
19 testRunner.notifyDone();
22 var filename = "filename=preflightCache.txt";
24 var xhr = new XMLHttpRequest;
25 xhr.onerror = errorHandler;
27 start = function()
29 // reset-temp-file.php reports an error on failure, for debugging problems with BuildBot setup.
30 if (xhr.responseText.length > 0)
31 log(xhr.responseText);
33 // Temp file removed. We can start the test now.
34 if (xhr.readyState == xhr.DONE) {
35 firstRequest();
39 xhr.open("GET", "/resources/reset-temp-file.php?" + filename, true);
40 xhr.onreadystatechange = start;
41 xhr.send();
43 function firstRequest()
45 xhr.onreadystatechange = function()
47 if (xhr.readyState == xhr.DONE) {
48 log(xhr.responseText);
49 log("PASS: First request complete");
50 secondRequest();
54 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache.php?" + filename, true);
55 xhr.send();
58 function secondRequest()
60 xhr.onreadystatechange = function()
62 if (xhr.readyState == xhr.DONE) {
63 log(xhr.responseText);
64 log("PASS: Second request complete");
65 if (window.testRunner)
66 testRunner.notifyDone();
70 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache.php?" + filename, true);
71 xhr.send();
74 </script>
75 </body>
76 </html>