invalid-src.html (1161B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Loading a non-parsing URL as an image should silently fail; triggering appropriate events</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <img id=brokenurl /> 7 <img id=emptysrc /> 8 <script> 9 async_test(function(t) { 10 var img = document.getElementById("brokenurl"); 11 img.src = "http://["; 12 13 // The errors should be queued in the event loop, so they should only trigger 14 // after this block of code finishes, not during the img.src setter itself 15 img.addEventListener('error', t.step_func(function() { 16 t.step_timeout(t.step_func_done(), 0); 17 })); 18 }, 'src="http://["'); 19 20 async_test(function(t) { 21 var img = document.getElementById("emptysrc"); 22 img.src = ""; 23 24 // Setting src to empty string triggers only error event. 25 // The errors should be queued in the event loop, so they should only trigger 26 // after this block of code finishes, not during the img.src setter itself 27 img.addEventListener('error', t.step_func(function() { 28 t.step_timeout(t.step_func_done(), 0); 29 })); 30 }, 'src=""'); 31 32 </script>