| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| var t = async_test("ForceReload should get a new image for an image document"); |
| |
| function triggerReload() { |
| // This depends on how image documents are implemented by Blink. |
| var iframe = document.getElementById('iframe'); |
| var img = iframe.contentDocument.body.getElementsByTagName('img')[0]; |
| var originalWidth = img.width; |
| var originalHeight = img.height; |
| |
| img.onerror = t.unreached_func(); |
| img.onload = t.step_func_done(function() { |
| assert_not_equals(originalWidth, img.width, "Should be reloaded: width"); |
| assert_not_equals(originalHeight, img.height, "Should be reloaded: height"); |
| }); |
| |
| if (window.internals) { |
| internals.forceImageReload(img); |
| } |
| } |
| </script> |
| |
| <!-- We call triggerReload() strictly after document load event, |
| because reloading is not enforced until document load event is finished. --> |
| <body onload="setTimeout(t.step_func(triggerReload), 0)"> |
| <iframe id="iframe" src="../cache/resources/random-cached-image.php?id=force-reload-image-document"></iframe> |
| </body> |