Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-img-element/decode/image-decode-image-document.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>HTMLImageElement.prototype.decode(), image document tests.</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="frame_imgdoc" src="about:blank"></iframe>
<script>
"use strict";
promise_test(function() {
return new Promise(function(resolve) {
var frame = document.getElementById("frame_imgdoc");
// Load an image in the iframe and then replace that.
frame.src = "/images/red.png";
frame.onload = function() {
let img = frame.contentDocument.body.firstElementChild;
img.src = "/images/green.png";
img.decode().then(function() {
resolve();
});
};
});
}, document.title + " Decode from iframe with image document, succeeds (img not loaded)");
</script>