| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <script src="resources/print.js"></script> |
| <script> |
| function test() |
| { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| image = document.createElement("img"); |
| image.setAttribute("style", "display:none"); |
| image.addEventListener("load", function() { |
| print('PASS', 'green'); |
| }, { once: true }); |
| image.addEventListener("beforeload", function() { |
| print('PASS: Hit the beforeload handler', 'green'); |
| document.body.removeChild(image); |
| image = null; |
| setTimeout(step2, 0); |
| }, { once: true }); |
| |
| document.body.appendChild(image); |
| |
| image.setAttribute("src", "../../images/resources/test-load.jpg"); |
| } |
| |
| function step2() |
| { |
| print("PASS: No assertions hit.", "green"); |
| |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <p>This test confirms that image loading properly handles a 'beforeload' events that removes the image from the document. It passes if no debug assertions are fired.</p> |
| <div id="console"></div> |
| </body> |
| </html> |