 Chromium Code Reviews
 Chromium Code Reviews Issue 1047563002:
  Fire load event for an image even if it was the last image we loaded successfully.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1047563002:
  Fire load event for an image even if it was the last image we loaded successfully.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html | 
| diff --git a/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html b/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..537c6efb91af141365a9f862fb066e32ecbe004f | 
| --- /dev/null | 
| +++ b/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html | 
| @@ -0,0 +1,39 @@ | 
| +<!DOCTYPE html> | 
| +<script src="../../resources/js-test.js"></script> | 
| +<script> | 
| + if (window.testRunner) { | 
| + testRunner.waitUntilDone(); | 
| + testRunner.dumpAsText(); | 
| + } | 
| + img = new Image(); | 
| + var onloadCounter = 0; | 
| + var testImage = 'resources/green.jpg'; | 
| + var resetImage = 'resources/bad-png.png'; | 
| + img.onload = function(){ | 
| + onloadCounter++; | 
| + debug("Image onload event fired for " + img.src.substring(img.src.lastIndexOf('/') + 1)); | 
| + if (onloadCounter == 2) { | 
| + document.getElementById('result').textContent = "PASS"; | 
| + if (window.testRunner) | 
| + testRunner.notifyDone(); | 
| + return; | 
| + } | 
| + if (onloadCounter == 1) { | 
| + setTimeout(function() { | 
| + img.src= resetImage; | 
| + img.src = testImage; | 
| + }, 0); | 
| + return; | 
| + } | 
| + document.getElementById('result').textContent = "FAIL"; | 
| + }; | 
| + setTimeout(function() { | 
| + img.src= resetImage; | 
| 
Yoav Weiss
2015/04/02 07:52:10
Is the first src setting relevant here? (since thi
 | 
| + img.src = testImage; | 
| + }, 0); | 
| +</script> | 
| +<div id="console"> | 
| +crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully.<br> | 
| +In this test we load an image. Then we make a request for a broken image which doesn't get the chance to complete before we attempt to load the same image again.<br> | 
| +</div> | 
| +<div id="result">FAIL</div> |