Files
firefox/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-drawImage-closed.html
T
Simon Pieters cf6a44070f Bug 1587400 [wpt PR 19596] - Move common/canvas-* files and update refs, a=testonly
Automatic update from web-platform-tests
Move common/canvas-* files and update refs

Also remove common/namespaces.js and fix affected files.

Part of #17913.

--

wpt-commits: 8f5a52b43147c0c7fb405eb501ac37cdd47423fb
wpt-pr: 19596
2019-10-24 18:03:21 +01:00

28 lines
981 B
HTML

<!DOCTYPE html>
<html>
<title>attempt to draw a closed ImageBitmap to a 2d canvas throws INVALID_STATE_ERR</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/2dcontext/resources/canvas-tests.js"></script>
<script>
promise_test(function(t) {
return new Promise(function(resolve, reject) {
const image = new Image();
image.onload = function() { resolve(image); };
image.onerror = function() { reject(); };
image.src = "/images/green-16x16.png";
}).then(function(image) {
return createImageBitmap(image, 0, 0, 16, 16);
}).then(function(imageBitmap) {
imageBitmap.close();
const canvas = document.createElement("canvas");
canvas.width = 16;
canvas.height = 16;
const ctx = canvas.getContext("2d");
assert_throws("InvalidStateError", function() { ctx.drawImage(imageBitmap, 0, 0); });
});
});
</script>