| <!DOCTYPE html> |
| <script src='../resources/js-test.js'></script> |
| <script> |
| jsTestIsAsync = true; |
| |
| description("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.dumpPermissionClientCallbacks(); |
| |
| document.write('<img src="resources/boston.gif" onload="loaded()">'); |
| |
| function loaded() |
| { |
| debug("PASS: first image loaded"); |
| if (window.testRunner && testRunner.setImagesAllowed) |
| testRunner.setImagesAllowed(false); |
| else |
| debug("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); |
| |
| setTimeout(finishJSTest, 0); |
| } |
| </script> |
| <div id="img"></div> |