OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="/js-test-resources/js-test.js"></script> | 2 <p>No credentials should be prompted for on seeing a 401 for <img crossorigin
>.</p> |
| 3 <div id=console></div> |
3 <script> | 4 <script> |
4 description("No credentials should be prompted for on seeing a 401 for <img c
rossorigin>."); | 5 if (window.testRunner) { |
5 | |
6 window.jsTestIsAsync = true; | |
7 if (window.testRunner) | |
8 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 testRunner.waitUntilDone(); |
| 8 } |
9 | 9 |
10 var testCount = 2; | 10 var testCount = 2; |
11 | 11 |
| 12 function log(msg) { |
| 13 var span = document.createElement("span"); |
| 14 document.getElementById("console").appendChild(span); |
| 15 span.innerHTML = msg + "<br/>"; |
| 16 } |
| 17 |
12 function finish() { | 18 function finish() { |
13 if (--testCount == 0) | 19 if (--testCount == 0) { |
14 finishJSTest(); | 20 log("TEST COMPLETE"); |
| 21 if (window.testRunner) |
| 22 testRunner.notifyDone(); |
| 23 } |
15 } | 24 } |
16 | 25 |
17 function pass() { | 26 function pass() { |
18 testPassed("Non-CORS image resource failed to load"); | 27 log("PASS Non-CORS image resource failed to load"); |
19 finish(); | 28 finish(); |
20 } | 29 } |
21 function fail(mode) { | 30 function fail(mode) { |
22 testFailed("Expected cross-origin access check failure for crossorigin='" +
mode + "' CORS fetch."); | 31 log("FAIL Expected cross-origin access check failure for crossorigin='" + mo
de + "' CORS fetch."); |
23 finish(); | 32 finish(); |
24 } | 33 } |
25 </script> | 34 </script> |
26 <img src="http://localhost:8000/security/resources/img-basic-auth.php?uid=41532"
crossorigin="anonymous" onload="fail('anonymous')" onerror="pass()"> | 35 <img src="http://localhost:8000/security/resources/img-basic-auth.php?uid=41532"
crossorigin="anonymous" onload="fail('anonymous')" onerror="pass()"> |
27 <img src="http://localhost:8000/security/resources/img-basic-auth.php?uid=41533"
crossorigin="use-credentials" onload="fail('use-credentials')" onerror="pass()"
> | 36 <img src="http://localhost:8000/security/resources/img-basic-auth.php?uid=41533"
crossorigin="use-credentials" onload="fail('use-credentials')" onerror="pass()"
> |
OLD | NEW |