image-decode-image-document.html (904B)
1 <!DOCTYPE html> 2 <title>HTMLImageElement.prototype.decode(), image document tests.</title> 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <iframe id="frame_imgdoc" src="about:blank"></iframe> 7 <script> 8 "use strict"; 9 10 promise_test(function() { 11 return new Promise(function(resolve) { 12 var frame = document.getElementById("frame_imgdoc"); 13 // Load an image in the iframe and then replace that. 14 frame.src = "/images/red.png"; 15 frame.onload = function() { 16 let img = frame.contentDocument.body.firstElementChild; 17 img.src = "/images/green.png"; 18 img.decode().then(function() { 19 resolve(); 20 }); 21 }; 22 }); 23 }, document.title + " Decode from iframe with image document, succeeds (img not loaded)"); 24 </script>