3 <p>Tests for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7877">bug 7877</a>:
4 XMLHttpRequest ignores username/password passed to open()
6 if (window.layoutTestController) {
7 layoutTestController.dumpAsText();
8 layoutTestController.waitUntilDone();
11 var console_messages = document.createElement("ol");
12 document.body.appendChild(console_messages);
16 var item = document.createElement("li");
17 item.appendChild(document.createTextNode(message));
18 console_messages.appendChild(item);
22 req = new XMLHttpRequest;
23 req.open("GET", "resources/basic-auth.php?uid=sync", false, "sync", "123");
25 log('sync: ' + req.responseText);
27 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync2"), false, "sync2", "123");
29 log('sync2: ' + req.responseText);
31 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync3").replace("http://", "http://sync3:123@"), false);
33 log('sync3: ' + req.responseText);
35 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync4").replace("http://", "http://incorrect:incorrect@"), false, "sync4", "123");
37 log('sync4: ' + req.responseText);
42 req.onreadystatechange = processStateChange;
43 req.open("GET", "resources/basic-auth.php?uid=async", true, "async", "123");
46 function processStateChange() {
48 if (req.readyState == 4){
49 if (req.status == 200){
52 log('async: ' + req.responseText);
53 req.onreadystatechange = processStateChange;
54 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async2"), true, "async2", "123");
56 } else if (asyncStep == 2) {
58 log('async2: ' + req.responseText);
59 req.onreadystatechange = processStateChange;
60 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async3").replace("http://", "http://async3:123@"), true, "async3", "123");
62 } else if (asyncStep == 3) {
64 log('async3: ' + req.responseText);
65 req.onreadystatechange = processStateChange;
66 req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async4").replace("http://", "http://incorrect:incorrect@"), true, "async4", "123");
68 } else if (asyncStep == 4) {
69 log('async4: ' + req.responseText);
70 if (window.layoutTestController)
71 layoutTestController.notifyDone();