| <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=preflightCache.txt"; |
| |
| var xhr = new XMLHttpRequest; |
| xhr.onerror = errorHandler; |
| |
| start = function() |
| { |
| // reset-temp-file.py reports an error on failure, for debugging problems with BuildBot setup. |
| if (xhr.responseText.length > 0) |
| log(xhr.responseText); |
| |
| // 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.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(); |
| } |
| } |
| |
| xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache.py?" + filename, true); |
| xhr.send(); |
| } |
| |
| </script> |
| </body> |
| </html> |