| Index: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
|
| diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
|
| index fc3b511bd708c0af94b693fe56dc362c97956b3a..196cdd0856b0f8bca2ef5a5be9859bc046d19945 100644
|
| --- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
|
| +++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
|
| @@ -1140,9 +1140,12 @@ bool BaseRenderingContext2D::computeDirtyRect(const FloatRect& localRect, const
|
| return true;
|
| }
|
|
|
| -ImageData* BaseRenderingContext2D::createImageData(ImageData* imageData) const
|
| +ImageData* BaseRenderingContext2D::createImageData(ImageData* imageData, ExceptionState &exceptionState) const
|
| {
|
| - return ImageData::create(imageData->size());
|
| + ImageData* result = ImageData::create(imageData->size());
|
| + if (!result)
|
| + exceptionState.throwRangeError("Out of memory at ImageData creation");
|
| + return result;
|
| }
|
|
|
| ImageData* BaseRenderingContext2D::createImageData(double sw, double sh, ExceptionState& exceptionState) const
|
| @@ -1162,7 +1165,10 @@ ImageData* BaseRenderingContext2D::createImageData(double sw, double sh, Excepti
|
| if (size.height() < 1)
|
| size.setHeight(1);
|
|
|
| - return ImageData::create(size);
|
| + ImageData* result = ImageData::create(size);
|
| + if (!result)
|
| + exceptionState.throwRangeError("Out of memory at ImageData creation");
|
| + return result;
|
| }
|
|
|
| ImageData* BaseRenderingContext2D::getImageData(double sx, double sy, double sw, double sh, ExceptionState& exceptionState) const
|
| @@ -1194,12 +1200,18 @@ ImageData* BaseRenderingContext2D::getImageData(double sx, double sy, double sw,
|
|
|
| IntRect imageDataRect = enclosingIntRect(logicalRect);
|
| ImageBuffer* buffer = imageBuffer();
|
| - if (!buffer || isContextLost())
|
| - return ImageData::create(imageDataRect.size());
|
| + if (!buffer || isContextLost()) {
|
| + ImageData* result = ImageData::create(imageDataRect.size());
|
| + if (!result)
|
| + exceptionState.throwRangeError("Out of memory at ImageData creation");
|
| + return result;
|
| + }
|
|
|
| WTF::ArrayBufferContents contents;
|
| - if (!buffer->getImageData(Unmultiplied, imageDataRect, contents))
|
| + if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) {
|
| + exceptionState.throwRangeError("Out of memory at ImageData creation");
|
| return nullptr;
|
| + }
|
|
|
| RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(contents);
|
| return ImageData::create(
|
|
|