image-decode-with-quick-attach-svg.tentative.html (975B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <meta name="timeout" content="long"> 4 <title>SVGImageElement.prototype.decode(), attach to DOM before promise resolves.</title> 5 <link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <svg></svg> 9 <script> 10 "use strict"; 11 12 let png = "/images/green.png?image-decode-with-quick-attach-" + Math.random(); 13 14 promise_test(function() { 15 var img = document.createElementNS('http://www.w3.org/2000/svg', 'image'); 16 img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', png); 17 const promise = img.decode().then(function(arg) { 18 assert_equals(arg, undefined); 19 }); 20 // Don't wait for the promise to resolve before attaching the image. 21 // The promise should still resolve successfully. 22 document.querySelector('svg').appendChild(img); 23 return promise; 24 }, document.title); 25 </script>