diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index 96ddadc96e5b..79b0f22c77ee 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -1397,7 +1397,7 @@ ImageBitmap::Create(nsIGlobalObject* aGlobal, const ImageBitmapSource& aSrc, } if (aCropRect.isSome() && (aCropRect->Width() == 0 || aCropRect->Height() == 0)) { - aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); + aRv.Throw(NS_ERROR_RANGE_ERR); return promise.forget(); } diff --git a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini b/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini index 071591d14c46..7db6a7667cfa 100644 --- a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini +++ b/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini @@ -1,64 +1,4 @@ [createImageBitmap-invalid-args.html] - [createImageBitmap with a HTMLImageElement source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLImageElement source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLImageElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a HTMLVideoElement source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLVideoElement source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLVideoElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a HTMLCanvasElement source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLCanvasElement source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a HTMLCanvasElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a OffscreenCanvas source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a OffscreenCanvas source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a OffscreenCanvas source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a ImageData source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a ImageData source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a ImageData source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a ImageBitmap source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a ImageBitmap source and sh set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException.] - expected: FAIL - - [createImageBitmap with a Blob source and sw set to 0 rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a Blob source and sh set to 0 rejects with a RangeError.] - expected: FAIL - [createImageBitmap with an oversized canvas source rejects with a RangeError.] expected: FAIL @@ -71,64 +11,31 @@ [createImageBitmap with an available but undecodable image source rejects with an InvalidStateError.] expected: FAIL - [createImageBitmap with a an HTMLCanvasElement source and sw set to 0] + [createImageBitmap with an HTMLCanvasElement source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a an HTMLCanvasElement source and sh set to 0] + [createImageBitmap with an HTMLVideoElement source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a an HTMLCanvasElement source and oversized (unallocatable) crop region] + [createImageBitmap with an HTMLImageElement source and sw set to 0] expected: FAIL - [createImageBitmap with a an HTMLVideoElement source and sw set to 0] + [createImageBitmap with an HTMLImageElement source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a an HTMLVideoElement source and sh set to 0] + [createImageBitmap with an OffscreenCanvas source and sw set to 0] expected: FAIL - [createImageBitmap with a an HTMLVideoElement source and oversized (unallocatable) crop region] + [createImageBitmap with an OffscreenCanvas source and sh set to 0] expected: FAIL - [createImageBitmap with a an HTMLImageElement source and sw set to 0] + [createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a an HTMLImageElement source and sh set to 0] + [createImageBitmap with an ImageData source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a an HTMLImageElement source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with a an OffscreenCanvas source and sw set to 0] - expected: FAIL - - [createImageBitmap with a an OffscreenCanvas source and sh set to 0] - expected: FAIL - - [createImageBitmap with a an OffscreenCanvas source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with a an ImageData source and sw set to 0] - expected: FAIL - - [createImageBitmap with a an ImageData source and sh set to 0] - expected: FAIL - - [createImageBitmap with a an ImageData source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with a an ImageBitmap source and sw set to 0] - expected: FAIL - - [createImageBitmap with a an ImageBitmap source and sh set to 0] - expected: FAIL - - [createImageBitmap with a an ImageBitmap source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with a a Blob source and sw set to 0] - expected: FAIL - - [createImageBitmap with a a Blob source and sh set to 0] + [createImageBitmap with an ImageBitmap source and oversized (unallocatable) crop region] expected: FAIL [createImageBitmap with an oversized canvas source.] @@ -146,37 +53,25 @@ [createImageBitmap with a closed ImageBitmap.] expected: FAIL - [createImageBitmap with a a bitmap HTMLImageElement source and sw set to 0] + [createImageBitmap with a bitmap HTMLImageElement source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a a bitmap HTMLImageElement source and sh set to 0] + [createImageBitmap with a bitmap SVGImageElement source and sw set to 0] expected: FAIL - [createImageBitmap with a a bitmap HTMLImageElement source and oversized (unallocatable) crop region] + [createImageBitmap with a bitmap SVGImageElement source and sh set to 0] expected: FAIL - [createImageBitmap with a a vector HTMLImageElement source and sw set to 0] + [createImageBitmap with a bitmap SVGImageElement source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with a a vector HTMLImageElement source and sh set to 0] + [createImageBitmap with a vector SVGImageElement source and sw set to 0] expected: FAIL - [createImageBitmap with a a bitmap SVGImageElement source and sw set to 0] + [createImageBitmap with a vector SVGImageElement source and sh set to 0] expected: FAIL - [createImageBitmap with a a bitmap SVGImageElement source and sh set to 0] - expected: FAIL - - [createImageBitmap with a a bitmap SVGImageElement source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with a a vector SVGImageElement source and sw set to 0] - expected: FAIL - - [createImageBitmap with a a vector SVGImageElement source and sh set to 0] - expected: FAIL - - [createImageBitmap with a a vector SVGImageElement source and oversized (unallocatable) crop region] + [createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region] expected: FAIL [createImageBitmap with CanvasRenderingContext2D image source.] @@ -188,12 +83,6 @@ [createImageBitmap with ArrayBuffer image source.] expected: FAIL - [createImageBitmap with a an HTMLVideoElement from a data URL source and sw set to 0] - expected: FAIL - - [createImageBitmap with a an HTMLVideoElement from a data URL source and sh set to 0] - expected: FAIL - - [createImageBitmap with a an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region] + [createImageBitmap with an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region] expected: FAIL diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html index 801ec418b6b2..a576e08da92a 100644 --- a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html +++ b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html @@ -49,7 +49,7 @@ function makeAvailableButBrokenImage(path) { testCases = [ { - description: 'createImageBitmap with a source and sw set to 0', + description: 'createImageBitmap with source and sw set to 0', promiseTestFunction: (source, t) => { return promise_rejects(t, new RangeError(), @@ -57,7 +57,7 @@ testCases = [ } }, { - description: 'createImageBitmap with a source and sh set to 0', + description: 'createImageBitmap with source and sh set to 0', promiseTestFunction: (source, t) => { return promise_rejects(t, new RangeError(), @@ -70,7 +70,7 @@ testCases = [ // InvalidStateError. // // Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025 - description: 'createImageBitmap with a source and oversized ' + + description: 'createImageBitmap with source and oversized ' + '(unallocatable) crop region', promiseTestFunction: (source, t) => {