| <script> |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| var request1 = new XMLHttpRequest(); |
| request1.onreadystatechange = function () { |
| if (request1.readyState === 4){ |
| alert("Verifying credentials are used when given: " + request1.responseText); |
| |
| // Verify that credentials are preemptively sent to the same realm, even when not explicitly given. |
| var request2 = new XMLHttpRequest(); |
| request2.onreadystatechange = function () { |
| if (request2.readyState === 4){ |
| alert("Verifying credentials are preemptively set when they have been given: " + request2.responseText); |
| |
| // Open the rest of the test in the same domain and verify that the credentials are used. |
| window.open('http://127.0.0.1:8000/security/resources/credentials-from-different-domains-continued-1.html'); |
| } |
| } |
| request2.open('GET', 'http://127.0.0.1:8000/security/resources/cors-basic-auth.py'); |
| request2.send(); |
| } |
| }; |
| request1.open('GET', 'http://127.0.0.1:8000/security/resources/cors-basic-auth.py', true, "user", "pass"); |
| request1.send(); |
| </script> |