Bug 1500786 - createImageBitmap should throw InvalidStateError with already closed imageBitmap as input, r=aosmond
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -1134,17 +1134,17 @@ ImageBitmap::CreateInternal(nsIGlobalObj
return ret.forget();
}
/* static */ already_AddRefed<ImageBitmap>
ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageBitmap& aImageBitmap,
const Maybe<IntRect>& aCropRect, ErrorResult& aRv)
{
if (!aImageBitmap.mData) {
- aRv.Throw(NS_ERROR_NOT_AVAILABLE);
+ aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
RefPtr<layers::Image> data = aImageBitmap.mData;
RefPtr<ImageBitmap> ret = new ImageBitmap(aGlobal, data, aImageBitmap.mAlphaType);
// Set the picture rectangle.
if (ret && aCropRect.isSome()) {
--- a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini
+++ b/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini
@@ -12,19 +12,16 @@
expected: FAIL
[createImageBitmap with a broken image source.]
expected: FAIL
[createImageBitmap with an available but undecodable image source.]
expected: FAIL
- [createImageBitmap with a closed ImageBitmap.]
- expected: FAIL
-
[createImageBitmap with a bitmap SVGImageElement source and sw set to 0]
expected: FAIL
[createImageBitmap with a bitmap SVGImageElement source and sh set to 0]
expected: FAIL
[createImageBitmap with a vector SVGImageElement source and sw set to 0]
expected: FAIL