1 <html> 2 <head> 3 <script src="resources/print.js"></script> 4 </head> 5 6 <body> 7 <p>This page tests the beforeload event on script elements. You should see a PASS message below if everything 8 works.</p> 9 <hr> 10 <div id='console'></div> 11 12 <script> 13 if (window.layoutTestController) 14 layoutTestController.dumpAsText(); 15 16 function beforeLoadFunc() 17 { 18 print("PASS", "green"); 19 event.preventDefault(); 20 } 21 22 document.body.addEventListener("beforeload", beforeLoadFunc, true); 23 var elt = document.createElement("script"); 24 elt.setAttribute("src", "resources/fail.js"); 25 document.body.appendChild(elt); 26 </script> 27 28 </body> 29 </html> 30