blob: c4038fd79d6b2990ef799cae83bdef63bea5c583 [file] [log] [blame]
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
}
var request1 = new XMLHttpRequest();
request1.onreadystatechange = function () {
if (request1.readyState === 4){
alert("Verifying credentials are used when given: " + request1.responseText);
// Verify that credentials are preemptively sent to the same realm, even when not explicitly given.
var request2 = new XMLHttpRequest();
request2.onreadystatechange = function () {
if (request2.readyState === 4){
alert("Verifying credentials are preemptively set when they have been given: " + request2.responseText);
// Open the rest of the test in the same domain and verify that the credentials are used.
window.open('http://127.0.0.1:8000/security/resources/credentials-from-different-domains-continued-1.html');
}
}
request2.open('GET', 'http://127.0.0.1:8000/security/resources/cors-basic-auth.php');
request2.send();
}
};
request1.open('GET', 'http://127.0.0.1:8000/security/resources/cors-basic-auth.php', true, "user", "pass");
request1.send();
</script>