Bug 1500734 - createImageBitmap should throw RangeError if sw or sh is 0 - r=aosmond

This commit is contained in:
Andrea Marchesini 2018-10-23 08:17:28 +02:00
Родитель 4439acd683
Коммит 17f8a25e39
3 изменённых файлов: 21 добавлений и 132 удалений

Просмотреть файл

@ -1397,7 +1397,7 @@ ImageBitmap::Create(nsIGlobalObject* aGlobal, const ImageBitmapSource& aSrc,
} }
if (aCropRect.isSome() && (aCropRect->Width() == 0 || aCropRect->Height() == 0)) { 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(); return promise.forget();
} }

Просмотреть файл

@ -1,64 +1,4 @@
[createImageBitmap-invalid-args.html] [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.] [createImageBitmap with an oversized canvas source rejects with a RangeError.]
expected: FAIL expected: FAIL
@ -71,64 +11,31 @@
[createImageBitmap with an available but undecodable image source rejects with an InvalidStateError.] [createImageBitmap with an available but undecodable image source rejects with an InvalidStateError.]
expected: FAIL 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 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 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 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 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 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 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 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 expected: FAIL
[createImageBitmap with a an HTMLImageElement source and oversized (unallocatable) crop region] [createImageBitmap with an ImageBitmap 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]
expected: FAIL expected: FAIL
[createImageBitmap with an oversized canvas source.] [createImageBitmap with an oversized canvas source.]
@ -146,37 +53,25 @@
[createImageBitmap with a closed ImageBitmap.] [createImageBitmap with a closed ImageBitmap.]
expected: FAIL 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 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 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 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 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 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 expected: FAIL
[createImageBitmap with a a bitmap SVGImageElement source and sh set to 0] [createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region]
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]
expected: FAIL expected: FAIL
[createImageBitmap with CanvasRenderingContext2D image source.] [createImageBitmap with CanvasRenderingContext2D image source.]
@ -188,12 +83,6 @@
[createImageBitmap with ArrayBuffer image source.] [createImageBitmap with ArrayBuffer image source.]
expected: FAIL expected: FAIL
[createImageBitmap with a an HTMLVideoElement from a data URL source and sw set to 0] [createImageBitmap with an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region]
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]
expected: FAIL expected: FAIL

Просмотреть файл

@ -49,7 +49,7 @@ function makeAvailableButBrokenImage(path) {
testCases = [ testCases = [
{ {
description: 'createImageBitmap with a <sourceType> source and sw set to 0', description: 'createImageBitmap with <sourceType> source and sw set to 0',
promiseTestFunction: promiseTestFunction:
(source, t) => { (source, t) => {
return promise_rejects(t, new RangeError(), return promise_rejects(t, new RangeError(),
@ -57,7 +57,7 @@ testCases = [
} }
}, },
{ {
description: 'createImageBitmap with a <sourceType> source and sh set to 0', description: 'createImageBitmap with <sourceType> source and sh set to 0',
promiseTestFunction: promiseTestFunction:
(source, t) => { (source, t) => {
return promise_rejects(t, new RangeError(), return promise_rejects(t, new RangeError(),
@ -70,7 +70,7 @@ testCases = [
// InvalidStateError. // InvalidStateError.
// //
// Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025 // Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025
description: 'createImageBitmap with a <sourceType> source and oversized ' + description: 'createImageBitmap with <sourceType> source and oversized ' +
'(unallocatable) crop region', '(unallocatable) crop region',
promiseTestFunction: promiseTestFunction:
(source, t) => { (source, t) => {