blob: 9dbc273e27c8c53b8426a6d091a22210476526f6 [file] [log] [blame]
<body>
<p>Test that default credentials aren't used when ones are provided to XHR explicitly.</p>
<span>Login: </span><span id="login">FAIL - Test not run</span><br>
<span>Default: </span><span id="default">FAIL - Test not run</span><br>
<span>Re-login: </span><span id="relogin">FAIL - Test not run</span><br>
<span>New default: </span><span id="newdefault">FAIL - Test not run</span>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var xhr = new XMLHttpRequest;
function f1()
{
// "?login1" is only here for ease of debugging; it doesn't affect behavior.
xhr.open("GET", "resources/re-login/resource.php?login1", true, "user1", "pass");
xhr.send("");
xhr.onload = function() {
document.getElementById("login").innerHTML = xhr.responseText == "User: user1, password: pass." ? "PASS" : "FAIL";
f2();
}
}
function f2()
{
// "?default" is only here for ease of debugging; it doesn't affect behavior.
xhr.open("GET", "resources/re-login/resource.php?default", true);
xhr.send("");
xhr.onload = function() {
document.getElementById("default").innerHTML = xhr.responseText == "User: user1, password: pass." ? "PASS" : "FAIL";
f3();
}
}
function f3()
{
// "?login2" is only here for ease of debugging; it doesn't affect behavior.
xhr.open("GET", "resources/re-login/resource.php?login2", true, "user2", "pass");
xhr.send("");
xhr.onload = function() {
document.getElementById("relogin").innerHTML = xhr.responseText == "User: user2, password: pass." ? "PASS" : "FAIL";
f4();
}
}
function f4()
{
// "?newdefault" is only here for ease of debugging; it doesn't affect behavior.
xhr.open("GET", "resources/re-login/resource.php?newdefault", true);
xhr.send("");
xhr.onload = function() {
document.getElementById("newdefault").innerHTML = xhr.responseText == "User: user2, password: pass." ? "PASS" : "FAIL";
if (window.testRunner)
testRunner.notifyDone();
}
}
f1();
</script>
</body>