| OLD | NEW |
| (Empty) |
| 1 <button onclick="presetAuthorization()">Start</button> | |
| 2 <pre id="console"></pre> | |
| 3 <script> | |
| 4 if (window.testRunner) { | |
| 5 testRunner.dumpAsText(); | |
| 6 testRunner.waitUntilDone(); | |
| 7 testRunner.setCanOpenWindows(); | |
| 8 } | |
| 9 | |
| 10 function log(message) | |
| 11 { | |
| 12 document.getElementById('console').appendChild(document.createTextNode(messa
ge + '\n')); | |
| 13 } | |
| 14 | |
| 15 function presetAuthorization() | |
| 16 { | |
| 17 if (window.testRunner) | |
| 18 testRunner.authenticateSession("http://localhost:8000/xmlhttprequest/res
ources/cross-origin-authorization.php", "test", "test"); | |
| 19 | |
| 20 test(); | |
| 21 } | |
| 22 | |
| 23 function test() | |
| 24 { | |
| 25 var req = new XMLHttpRequest; | |
| 26 req.open("GET", "http://localhost:8000/xmlhttprequest/resources/cross-origin
-authorization.php", false); | |
| 27 try { | |
| 28 req.send(); | |
| 29 log((req.status == 401) ? "PASS" : "FAIL: credentials were sent"); | |
| 30 } catch (ex) { | |
| 31 // This is not a correct outcome, but it's fine for the purposes of this
test. | |
| 32 log("PASS"); | |
| 33 } | |
| 34 log("DONE"); | |
| 35 if (window.testRunner) | |
| 36 testRunner.notifyDone(); | |
| 37 } | |
| 38 | |
| 39 | |
| 40 if (window.testRunner) | |
| 41 presetAuthorization(); | |
| 42 </script> | |
| OLD | NEW |