Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / access-control-basic-allow-preflight-cache-invalidation-by-header.html
blobd9dbf1fc9a4f9c033bf45af9a9df6a652c415f9d
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=preflightCacheInvalidationByHeader.txt";
24 var xhr = new XMLHttpRequest;
25 xhr.onerror = errorHandler;
27 start = function()
29 // Temp file removed. We can start the test now.
30 if (xhr.readyState == xhr.DONE) {
31 firstRequest();
35 xhr.open("GET", "/resources/reset-temp-file.php?" + filename, true);
36 xhr.onreadystatechange = start;
37 xhr.send();
39 function firstRequest()
41 xhr.onreadystatechange = function()
43 if (xhr.readyState == xhr.DONE) {
44 log(xhr.responseText);
45 log("PASS: First request complete");
46 secondRequest();
50 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php?" + filename, true);
51 xhr.send();
54 function secondRequest()
56 xhr.onreadystatechange = function()
58 if (xhr.readyState == xhr.DONE) {
59 log(xhr.responseText);
60 log("PASS: Second request complete");
61 if (window.testRunner)
62 testRunner.notifyDone();
66 // Send a header not included in the inital cache.
67 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php?" + filename, true);
68 xhr.setRequestHeader("x-webkit-test", "headerValue");
69 xhr.send();
72 </script>
73 </body>
74 </html>