OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <title>crbug.com/468915: Resetting or removing the src attribute should reset th e image immediately, rather than waiting for an asynchronous load to do it.</tit le> |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
3 <script> | 5 <script> |
4 if (window.testRunner) { | 6 async_test(function(t) { |
5 testRunner.waitUntilDone(); | 7 var img = new Image(); |
6 testRunner.dumpAsText(); | 8 img.onload = t.step_func_done(function() { |
7 } | 9 assert_greater_than(img.naturalWidth, 0, "Image width should be greater than zero"); |
fs
2016/08/16 10:42:42
Nit: Could probably even use the exact value from
sivag
2016/08/16 11:54:21
Done.
| |
8 img = new Image(); | |
9 var testImage = 'resources/green.jpg'; | |
10 img.onload = function(){ | |
11 img.removeAttribute('src'); | 10 img.removeAttribute('src'); |
12 if (img.naturalWidth > 0) { | 11 assert_equals(img.naturalWidth, 0); |
13 debug("Natural width is : " + img.naturalWidth + " and should be 0." ); | 12 }); |
14 if (window.testRunner) | 13 img.src = 'resources/green.jpg'; |
15 testRunner.notifyDone(); | 14 }); |
16 return; | |
17 } | |
18 document.getElementById('result').textContent = "PASS"; | |
19 if (window.testRunner) | |
20 testRunner.notifyDone(); | |
21 }; | |
22 setTimeout(function() { | |
23 img.src = testImage; | |
24 }, 0); | |
25 </script> | 15 </script> |
26 <div id="console"> | |
27 crbug.com/468915: Resetting or removing the src attribute should reset the i mage immediately, rather than waiting for an asynchronous load to do it.<br> | |
28 </div> | |
29 <div id="result">FAIL</div> | |
30 | |
OLD | NEW |