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();
16 var xhr
= new XMLHttpRequest();
19 xhr
.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-preflight-denied-xsrf.php?state=reset", false);
22 log("FAIL: Unable to reset server state: [" + e
.message
+ "].");
26 xhr
= new XMLHttpRequest();
29 xhr
.open("DELETE", "http://localhost:8000/xmlhttprequest/resources/access-control-preflight-denied-xsrf.php?state=method", true);
31 log("FAIL: Exception thrown. Cross-domain access is not allowed in first 'open'. [" + e
.message
+ "].");
35 xhr
.onerror = function() {
36 xhr
= new XMLHttpRequest();
39 xhr
.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-preflight-denied-xsrf.php?state=complete", false);
43 log("FAIL: Exception thrown. Cross-domain access is not allowed in second 'send'. [" + e
.message
+ "].");
46 log("FAIL: Exception thrown. Cross-domain access is not allowed in second 'open'. [" + e
.message
+ "].");
49 log(xhr
.responseText
);
50 if (window
.testRunner
)
51 testRunner
.notifyDone();
54 xhr
.onreadystatechange = function() {
55 if (xhr
.readyState
== 4 && xhr
.status
== 200)
56 log("FAIL: Cross-domain access allowed in first send without throwing an exception");