| <html> |
| <head> |
| <script> |
| // Blocked images can be reloaded, so neither onload nor onerror is called. |
| // Only check here that onload is never called when image is blocked. |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.dumpPermissionClientCallbacks(); |
| } |
| |
| function log(a) |
| { |
| document.getElementById("results").innerHTML += a + "<br>"; |
| } |
| |
| function loaded() |
| { |
| log("PASS: first image loaded"); |
| if (window.testRunner && testRunner.setImagesAllowed) |
| testRunner.setImagesAllowed(false); |
| else |
| log("This test requires testRunner.setImagesAllowed, so it be can't run in a browser."); |
| |
| // Load an image not in cache. |
| var img = document.createElement('img'); |
| img.onload = function () { log("FAIL: not cached image loaded"); } |
| img.src = "resources/boston.gif?nocache"; |
| document.getElementById("img").appendChild(img); |
| |
| // Load an image from cache. |
| var imgFromCache = document.createElement('img'); |
| imgFromCache.onload = function () { log("FAIL: image from cache loaded"); } |
| imgFromCache.src = "resources/boston.gif"; |
| document.getElementById("img").appendChild(imgFromCache); |
| |
| // Add an iframe with an image. |
| var iframe = document.createElement('iframe'); |
| iframe.src = "resources/image.html"; |
| document.getElementById("img").appendChild(iframe); |
| } |
| </script> |
| </head> |
| <body> |
| <img src="resources/boston.gif" onload="loaded()"> |
| <div id="img"></div> |
| <div id="results"></div> |
| </body> |
| </html> |