| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 </head> | 3 </head> |
| 4 <body> | 4 <body> |
| 5 <script src="../../js-test-resources/js-test-pre.js"></script> | 5 <script src="../../js-test-resources/js-test-pre.js"></script> |
| 6 <script> | 6 <script> |
| 7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
| 8 description("The test passes if 'window.onerror' gets sanitized informat
ion about an exception thrown in a script loaded with a 'crossorigin' attribute,
and delivered without valid CORS headers."); | 8 description("The test passes if 'window.onerror' is not invoked on a scr
ipt loaded with a 'crossorigin' attribute, but delivered without valid CORS head
ers."); |
| 9 |
| 10 var still_running = true; |
| 11 function shutdown() { |
| 12 if (still_running) { |
| 13 finishJSTest(); |
| 14 still_running = false; |
| 15 } |
| 16 } |
| 9 | 17 |
| 10 window.onerror = function(msg, url, line, column, error) { | 18 window.onerror = function(msg, url, line, column, error) { |
| 11 window.msg = msg; | 19 window.fail = "FAIL"; |
| 12 window.url = url; | 20 shouldBeUndefined("window.fail"); |
| 13 window.line = line; | 21 shutdown(); |
| 14 window.column = column; | |
| 15 window.errorObject = error; | |
| 16 shouldBeEqualToString("msg", "Script error."); | |
| 17 shouldBeEqualToString("url", ""); | |
| 18 shouldBe("line", "0"); | |
| 19 shouldBe("column", "0"); | |
| 20 shouldBeNull("window.errorObject"); | |
| 21 finishJSTest(); | |
| 22 } | 22 } |
| 23 </script> | 23 </script> |
| 24 <script crossorigin="anonymous" src="http://localhost:8000/security/resource
s/cors-script.php?fail=true&cors=false"></script> | 24 <script crossorigin="anonymous" src="http://localhost:8000/security/resource
s/cors-script.php?fail=true&cors=false"></script> |
| 25 <script src="../../js-test-resources/js-test-post.js"></script> | 25 <script src="../../js-test-resources/js-test-post.js"></script> |
| 26 <script>shutdown();</script> |
| 26 </body> | 27 </body> |
| 27 </html> | 28 </html> |
| OLD | NEW |