3 <pre id='console'
></pre>
4 <script type=
"text/javascript">
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
;
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
) {
39 xhr
.open("GET", "/resources/reset-temp-file.php?" + filename
, true);
40 xhr
.onreadystatechange
= start
;
43 function firstRequest()
45 xhr
.onreadystatechange = function()
47 if (xhr
.readyState
== xhr
.DONE
) {
48 log(xhr
.responseText
);
49 log("PASS: First request complete");
54 xhr
.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache.php?" + filename
, true);
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);