Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLScriptElement / script-load-events.html
blob8839f78b388d1f303b1977110157f755a79e11b3
1 <html>
2 <head>
3 <title>&lt;SCRIPT&gt; load and error events</title>
4 <script type="text/javascript">
5 var status_ = new Array();
7 function loaded(i)
9 status_[i] = "L";
12 function erred(i)
14 status_[i] = "E";
17 function endTest()
19 var failures = "";
20 if (status_[0] != "E")
21 failures += "0 ";
22 if (status_[1] != "E")
23 failures += "1 ";
25 if (status_[2] != "L")
26 failures += "2 ";
27 if (status_[4] != "L")
28 failures += "4 ";
29 if (status_[5] != "L")
30 failures += "5 ";
32 var results = document.getElementById("results");
33 if (failures)
34 results.innerHTML = "FAIL: The following tests failed: " + failures;
35 else
36 results.innerHTML = "PASS";
38 if (window.testRunner)
39 testRunner.notifyDone();
42 function test()
44 if (window.testRunner) {
45 testRunner.dumpAsText();
46 testRunner.waitUntilDone();
49 var e = document.createElement("script");
50 e.type = "text/javascript";
51 e.src = 'resources/script-load.js';
52 e.onload = function() {
53 loaded(5);
54 endTest();
56 document.getElementsByTagName("head")[0].appendChild( e );
58 </script>
59 </head>
60 <body onload="test()">
61 <script type="text/javascript" onload="loaded(0)" onerror="erred(0)" src="resources/certainlydoesnotexist.js"></script>
62 <script type="text/javascript" onload="loaded(1)" onerror="erred(1)" src="resources/certainlydoesnotexist.js"></script>
63 <script type="text/javascript" onload="loaded(2)" onerror="erred(2)" src="resources/script-load.js"></script>
64 <!-- 3 was a self-closing script tag, however that is covered by fast/parser/script-tag-with-trailing-slash.html -->
65 <script type="text/javascript">
66 document.write('<script type="text/javascript" onload="loaded(4)" onerror="erred(4)" src="resources/script-load.js"></script'+'>');
67 </script>
68 This tests for regressions against <i><a href="https://bugs.webkit.org/show_bug.cgi?id=5812">https://bugs.webkit.org/show_bug.cgi?id=5812</a>
69 Generate load events for &lt;script&gt; elements</i>.
70 <hr>
71 <p id="results">FAIL: Test never finished.</p>
72 </body>
73 </html>