blob: b36bd721745bdfc316278a397dbce19827645730 [file] [log] [blame]
<button onclick="presetAuthorization()">Start</button>
<pre id="console"></pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
}
function presetAuthorization()
{
if (window.testRunner)
testRunner.authenticateSession("http://localhost:8000/xmlhttprequest/resources/cross-origin-authorization.py", "test", "test");
test();
}
function test()
{
var req = new XMLHttpRequest;
req.open("GET", "http://localhost:8000/xmlhttprequest/resources/cross-origin-authorization.py", false);
try {
req.send();
log((req.status == 401) ? "PASS" : "FAIL: credentials were sent");
} catch (ex) {
// This is not a correct outcome, but it's fine for the purposes of this test.
log("PASS");
}
log("DONE");
if (window.testRunner)
testRunner.notifyDone();
}
if (window.testRunner)
presetAuthorization();
</script>