| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/js-test-resources/js-test.js"></script> | |
| 5 <script> | |
| 6 function loadScript(url, async, onload, onerror) { | |
| 7 var script = document.createElement("script"); | |
| 8 script.async = async; | |
| 9 script.onload = onload; | |
| 10 if (onerror) | |
| 11 script.onerror = onerror; | |
| 12 script.src = url; | |
| 13 document.head.appendChild(script); | |
| 14 } | |
| 15 </script> | |
| 16 </head> | |
| 17 <body> | |
| 18 <script> | |
| 19 description("Slow scripts that fail to load should not dispatch multiple error e
vents"); | |
| 20 | |
| 21 window.jsTestIsAsync = true; | |
| 22 | |
| 23 if (window.testRunner) { | |
| 24 testRunner.dumpAsText(); | |
| 25 testRunner.waitUntilDone(); | |
| 26 } | |
| 27 | |
| 28 var firstOnErrorHandlerHasRun = false; | |
| 29 function failedFirst() { | |
| 30 shouldBeFalse("firstOnErrorHandlerHasRun"); | |
| 31 firstOnErrorHandlerHasRun = true; | |
| 32 // Issue another script load so as to have the script runner | |
| 33 // revisit its script queue. This should not result in this | |
| 34 // onerror handler running again. | |
| 35 loadScript("resources/success.js?1", true); | |
| 36 } | |
| 37 | |
| 38 var secondOnErrorHandlerHasRun = false; | |
| 39 function failedSecond() { | |
| 40 shouldBeTrue("firstOnErrorHandlerHasRun"); | |
| 41 shouldBeFalse("secondOnErrorHandlerHasRun"); | |
| 42 secondOnErrorHandlerHasRun = true; | |
| 43 loadScript("resources/success.js?2", true, finishJSTest); | |
| 44 } | |
| 45 | |
| 46 function unexpectedLoad() { | |
| 47 testFailed("Script should not have loaded"); | |
| 48 finishJSTest(); | |
| 49 } | |
| 50 | |
| 51 loadScript("resources/success.js?3", false); | |
| 52 loadScript("resources/slow-nonexisting-script.php?sleep=1", false, unexpectedLoa
d, failedFirst); | |
| 53 loadScript("resources/slow-nonexisting-script.php?sleep=2", false, unexpectedLoa
d, failedSecond); | |
| 54 </script> | |
| 55 </body> | |
| 56 </html> | |
| OLD | NEW |