OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../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("Script that fails to load should not dispatch multiple error events
"); |
| 20 |
| 21 window.jsTestIsAsync = true; |
| 22 |
| 23 if (window.testRunner) { |
| 24 testRunner.dumpAsText(); |
| 25 testRunner.waitUntilDone(); |
| 26 } |
| 27 |
| 28 var numberOfTimesOnErrorHandlerHasRun = 0; |
| 29 function step2() { |
| 30 shouldBeZero("numberOfTimesOnErrorHandlerHasRun"); |
| 31 numberOfTimesOnErrorHandlerHasRun++; |
| 32 // Issue another script load so as to have the script runner |
| 33 // revisit its script queue. It must not include the sync script |
| 34 // that triggered the dispatch of an error event and the running of |
| 35 // this handler. |
| 36 loadScript("resources/script-load.js", true, finishJSTest); |
| 37 } |
| 38 |
| 39 function unexpectedLoad() { |
| 40 testFailed("Script should not have loaded"); |
| 41 finishJSTest(); |
| 42 } |
| 43 |
| 44 loadScript("non-existing.js", false, unexpectedLoad, step2); |
| 45 </script> |
| 46 </body> |
| 47 </html> |
OLD | NEW |