blob: e33b2d5ee652a66f7ab5776fc63b04332b1b60f9 [file] [log] [blame]
<!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 <img> element");
function triggerReload() {
var img = document.getElementById('img');
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)">
<img id="img" src="../cache/resources/random-cached-image.php?id=force-reload">
</body>