blob: 84149c02ab3d33b6d88321f9500b9050cf020707 [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.py?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.py?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.py?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.py?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>