Bug 1266808 - throw exception when canvas.drawImage passed closed ImageBitmap r=baku
☠☠ backed out by dc80991796e0 ☠ ☠
authoraardgoose <angus.sawyer@gmail.com>
Thu, 26 Sep 2019 21:54:06 +0000
changeset 495247 f2530502f6c4790ba778f1ceab633fcf161fc2f6
parent 495246 d4a0dc365ef9b1c5a4e867f8bacc41f967dd0900
child 495248 14e2e5325cec207461a9185adb1804bcb56d1fb2
push id96549
push userrgurzau@mozilla.com
push dateFri, 27 Sep 2019 08:15:18 +0000
treeherderautoland@f2530502f6c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1266808
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1266808 - throw exception when canvas.drawImage passed closed ImageBitmap r=baku Differential Revision: https://phabricator.services.mozilla.com/D31048
dom/canvas/CanvasRenderingContext2D.cpp
testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-drawImage-closed.html.ini
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -4370,16 +4370,17 @@ void CanvasRenderingContext2D::DrawImage
     if (canvas->IsWriteOnly()) {
       SetWriteOnly();
     }
   } else if (aImage.IsImageBitmap()) {
     ImageBitmap& imageBitmap = aImage.GetAsImageBitmap();
     srcSurf = imageBitmap.PrepareForDrawTarget(mTarget);
 
     if (!srcSurf) {
+      aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
 
     if (imageBitmap.IsWriteOnly()) {
       SetWriteOnly();
     }
 
     imgSize = intrinsicImgSize =
deleted file mode 100644
--- a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-drawImage-closed.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[createImageBitmap-drawImage-closed.html]
-  [attempt to draw a closed ImageBitmap to a 2d canvas throws INVALID_STATE_ERR]
-    expected: FAIL
-