4 function print(message
, color
)
6 var paragraph
= document
.createElement("div");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 paragraph
.style
.fontFamily
= "monospace";
10 paragraph
.style
.color
= color
;
11 document
.getElementById("console").appendChild(paragraph
);
16 if (window
.testRunner
) {
17 testRunner
.dumpAsText();
18 testRunner
.waitUntilDone();
19 window
.setTimeout("testRunner.notifyDone()", 5000); // prevent hang on failure
22 var div
= document
.createElement("div");
23 div
.setAttribute("onerror", "print('FAILED: dynamic script load error bubbled'); \
24 if (window.testRunner) \
25 testRunner.notifyDone();");
27 var script
= document
.createElement("script");
28 script
.src
="file:///GregTheBunny.js";
29 div
.appendChild(script
);
31 // force the script to load
32 document
.body
.appendChild(div
);
35 function scriptOnerror()
37 print('PASS: script error handler invoked');
39 // Allow event bubbling phase to complete.
40 setTimeout(function() {
41 if (window
.testRunner
)
42 testRunner
.notifyDone();
46 window
.onerror = function() {
47 print('FAILED: window.onerror handler invoked');
51 <body onload=
"test();">
53 <div id='console'
></div>
54 <div onerror=
"print('FAILED: inline script load error bubbled')">
55 <script src=
"file:///GregTheBunny.js" onerror=
"scriptOnerror()"></script>