| <html> |
| <body> |
| <pre id='console'></pre> |
| <script type="text/javascript"> |
| function log(message) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function errorHandler(event) |
| { |
| log("FAIL: Network error. "); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| var filename = "filename=preflightCacheInvalidationByHeader.txt"; |
| |
| var xhr = new XMLHttpRequest; |
| xhr.onerror = errorHandler; |
| |
| start = function() |
| { |
| // Temp file removed. We can start the test now. |
| if (xhr.readyState == xhr.DONE) { |
| firstRequest(); |
| } |
| } |
| |
| xhr.open("GET", "/resources/reset-temp-file.py?" + filename, true); |
| xhr.onreadystatechange = start; |
| xhr.send(); |
| |
| function firstRequest() |
| { |
| xhr.onreadystatechange = function() |
| { |
| if (xhr.readyState == xhr.DONE) { |
| log(xhr.responseText); |
| log("PASS: First request complete"); |
| secondRequest(); |
| } |
| } |
| |
| xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.py?" + filename, true); |
| xhr.send(); |
| } |
| |
| function secondRequest() |
| { |
| xhr.onreadystatechange = function() |
| { |
| if (xhr.readyState == xhr.DONE) { |
| log(xhr.responseText); |
| log("PASS: Second request complete"); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| } |
| |
| // Send a header not included in the inital cache. |
| xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.py?" + filename, true); |
| xhr.setRequestHeader("x-webkit-test", "headerValue"); |
| xhr.send(); |
| } |
| |
| </script> |
| </body> |
| </html> |