| OLD | NEW |
| 1 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13075">bug 13075</a>
: | 1 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13075">bug 13075</a>
: |
| 2 XMLHttpRequest with failed authentication should set status to 401.</p> | 2 XMLHttpRequest with failed authentication should set status to 401.</p> |
| 3 <ol> | 3 <ol> |
| 4 <li>Sync, no credentials: | 4 <li>Sync, no credentials: |
| 5 <li>Sync, incorrect credentials: | 5 <li>Sync, incorrect credentials: |
| 6 <li>Async, no credentials: | 6 <li>Async, no credentials: |
| 7 <li>Async, incorrect credentials: | 7 <li>Async, incorrect credentials: |
| 8 </ol> | 8 </ol> |
| 9 <script> | 9 <script> |
| 10 function checkResult(n, code) { | 10 function checkResult(n, code) { |
| 11 document.getElementsByTagName("li")[n - 1].firstChild.nodeValue += | 11 document.getElementsByTagName("li")[n - 1].firstChild.nodeValue += |
| 12 ((code == 401) ? " OK" : (" " + code + " != 401")); | 12 ((code == 401) ? " OK" : (" " + code + " != 401")); |
| 13 } | 13 } |
| 14 | 14 |
| 15 function checkFailure(n, code) { |
| 16 document.getElementsByTagName("li")[n - 1].firstChild.nodeValue += |
| 17 ((code == 0) ? " OK" : (" " + code + " != 0")); |
| 18 } |
| 19 |
| 15 function log(n, message) { | 20 function log(n, message) { |
| 16 document.getElementsByTagName("li")[n - 1].firstChild.nodeValue += | 21 document.getElementsByTagName("li")[n - 1].firstChild.nodeValue += |
| 17 " " + message; | 22 " " + message; |
| 18 } | 23 } |
| 19 | 24 |
| 20 | 25 |
| 21 if (window.testRunner) { | 26 if (window.testRunner) { |
| 22 testRunner.dumpAsText(); | 27 testRunner.dumpAsText(); |
| 23 testRunner.waitUntilDone(); | 28 testRunner.waitUntilDone(); |
| 24 } else { | 29 } else { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 log(3, ex); | 62 log(3, ex); |
| 58 test4(); | 63 test4(); |
| 59 } | 64 } |
| 60 | 65 |
| 61 function test4() { | 66 function test4() { |
| 62 try { | 67 try { |
| 63 var r = new XMLHttpRequest(); | 68 var r = new XMLHttpRequest(); |
| 64 r.open("GET", "resources/basic-auth/basic-auth.php?uid=login4", true, "b
adname", "passpw"); | 69 r.open("GET", "resources/basic-auth/basic-auth.php?uid=login4", true, "b
adname", "passpw"); |
| 65 r.onreadystatechange = function() { | 70 r.onreadystatechange = function() { |
| 66 if (r.readyState == 4) { | 71 if (r.readyState == 4) { |
| 67 checkResult(4, r.status); | 72 checkFailure(4, r.status); |
| 68 testRunner.notifyDone(); | 73 testRunner.notifyDone(); |
| 69 } | 74 } |
| 70 }; | 75 }; |
| 71 r.send(); | 76 r.send(); |
| 72 } catch (ex) { | 77 } catch (ex) { |
| 73 log(4, ex); | 78 log(4, ex); |
| 74 testRunner.notifyDone(); | 79 testRunner.notifyDone(); |
| 75 } | 80 } |
| 76 } | 81 } |
| 77 </script> | 82 </script> |
| OLD | NEW |