| <html> |
| <head> |
| <title><SCRIPT> load and error events</title> |
| <script type="text/javascript"> |
| var status_ = new Array(); |
| |
| function loaded(i) |
| { |
| status_[i] = "L"; |
| } |
| |
| function erred(i) |
| { |
| status_[i] = "E"; |
| } |
| |
| function endTest() |
| { |
| var failures = ""; |
| if (status_[0] != "E") |
| failures += "0 "; |
| if (status_[1] != "E") |
| failures += "1 "; |
| |
| if (status_[2] != "L") |
| failures += "2 "; |
| if (status_[3] != "L") |
| failures += "3 "; |
| if (status_[4] != "L") |
| failures += "4 "; |
| if (status_[5] != "L") |
| failures += "5 "; |
| |
| var results = document.getElementById("results"); |
| if (failures) |
| results.innerHTML = "FAIL: The following tests failed: " + failures; |
| else |
| results.innerHTML = "PASS"; |
| |
| if (window.layoutTestController) |
| layoutTestController.notifyDone(); |
| } |
| |
| function test() |
| { |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.waitUntilDone(); |
| } |
| |
| var e = document.createElement("script"); |
| e.type = "text/javascript"; |
| e.src = 'resources/script-load.js'; |
| e.onload = function() { |
| loaded(5); |
| endTest(); |
| }; |
| document.getElementsByTagName("head")[0].appendChild( e ); |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <script type="text/javascript" onload="loaded(0)" onerror="erred(0)" src="resources/certainlydoesnotexist.js"></script> |
| <script type="text/javascript" onload="loaded(1)" onerror="erred(1)" src="resources/certainlydoesnotexist.js"></script> |
| <script type="text/javascript" onload="loaded(2)" onerror="erred(2)" src="resources/script-load.js"></script> |
| <script type="text/javascript" onload="loaded(3)" onerror="erred(3)" src="resources/script-load.js"/> |
| <script type="text/javascript"> |
| document.write('<script type="text/javascript" onload="loaded(4)" onerror="erred(4)" src="resources/script-load.js"></script'+'>'); |
| </script> |
| This tests for regressions against <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=5812">http://bugzilla.opendarwin.org/show_bug.cgi?id=5812</a> |
| Generate load events for <script> elements</i>. |
| <hr> |
| <p id="results">FAIL: Test never finished.</p> |
| </body> |
| </html> |