2011-04-27 Eric Seidel <eric@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 05:53:01 +0000 (05:53 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 05:53:01 +0000 (05:53 +0000)
        Reviewed by Ojan Vafai.

        Log more information when http/tests/xmlhttprequest/basic-auth.html fails
        https://bugs.webkit.org/show_bug.cgi?id=59651

        Very basic, but it's better than nothing.

        * http/tests/xmlhttprequest/basic-auth.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85160 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/basic-auth.html

index 08a8c77..ffc097a 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-27  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Ojan Vafai.
+
+        Log more information when http/tests/xmlhttprequest/basic-auth.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=59651
+
+        Very basic, but it's better than nothing.
+
+        * http/tests/xmlhttprequest/basic-auth.html:
+
 2011-04-27  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Beth Dakin.
index 9625e03..c213d62 100644 (file)
         console_messages.appendChild(item);
     }
 
+    function sendAndLogResponse(uid, req)
+    {
+        try {
+            req.send("");
+            log(uid + ': ' + req.responseText);
+        } catch (e) {
+            log(uid + ": req.send raised exception: " + e);
+            log(uid + ": req.readyState: " + req.readyState);
+            log(uid + ": req.status: " + req.status);
+        }
+    }
+
     // sync
     req = new XMLHttpRequest;
     req.open("GET", "resources/basic-auth/basic-auth.php?uid=sync", false, "sync", "123");
-    req.send("");
-    log('sync: ' + req.responseText);
+    sendAndLogResponse("sync", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync2"), false, "sync2", "123");
-    req.send("");
-    log('sync2: ' + req.responseText);
+    sendAndLogResponse("sync2", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync3").replace("http://", "http://sync3:123@"), false);
-    req.send("");
-    log('sync3: ' + req.responseText);
+    sendAndLogResponse("sync3", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync4").replace("http://", "http://incorrect:incorrect@"), false, "sync4", "123");
-    req.send("");
-    log('sync4: ' + req.responseText);
+    sendAndLogResponse("sync4", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync5").replace("http://", "http://sync5:123@"), false, undefined, undefined);
-    req.send("");
-    log('sync5: ' + req.responseText);
+    sendAndLogResponse("sync5", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync6").replace("http://", "http://sync6:123@"), false, undefined);
-    req.send("");
-    log('sync6: ' + req.responseText);
+    sendAndLogResponse("sync6", req);
 
     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync7").replace("http://", "http://sync7:123@"), false, undefined, "incorrect");
-    req.send("");
-    log('sync7: ' + req.responseText);
+    sendAndLogResponse("sync7", req);
 
     // async
     var asyncStep = 1;
             if (window.layoutTestController)
               layoutTestController.notifyDone();
           }
+        } else {
+            log("async" + asyncStep + " failed with unexpected status: " + req.status);
         }
       }
     }
-
 </script>
 </body>
 </html>