Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 234903003: Should throw TypeError instead of TypeMismatchError (canvas) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index a2c331879613a4a8a33fd2af8f564c1b2e132949..a0807a878501ba7dbf78ad80b7d9f2cee8a31d97 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -1037,7 +1037,7 @@ void CanvasRenderingContext2D::fill(Path2D* domPath, ExceptionState& exceptionSt
void CanvasRenderingContext2D::fill(Path2D* domPath, const String& windingRuleString, ExceptionState& exceptionState)
{
if (!domPath) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
return;
}
@@ -1080,7 +1080,7 @@ void CanvasRenderingContext2D::stroke()
void CanvasRenderingContext2D::stroke(Path2D* domPath, ExceptionState& exceptionState)
{
if (!domPath) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
return;
}
@@ -1119,7 +1119,7 @@ void CanvasRenderingContext2D::clip(Path2D* domPath, ExceptionState& exceptionSt
void CanvasRenderingContext2D::clip(Path2D* domPath, const String& windingRuleString, ExceptionState& exceptionState)
{
if (!domPath) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
return;
}
@@ -1139,7 +1139,7 @@ bool CanvasRenderingContext2D::isPointInPath(Path2D* domPath, const float x, con
bool CanvasRenderingContext2D::isPointInPath(Path2D* domPath, const float x, const float y, const String& windingRuleString, ExceptionState& exceptionState)
{
if (!domPath) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
return false;
}
@@ -1175,7 +1175,7 @@ bool CanvasRenderingContext2D::isPointInStroke(const float x, const float y)
bool CanvasRenderingContext2D::isPointInStroke(Path2D* domPath, const float x, const float y, ExceptionState& exceptionState)
{
if (!domPath) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
return false;
}
@@ -1213,7 +1213,7 @@ void CanvasRenderingContext2D::scrollPathIntoView()
void CanvasRenderingContext2D::scrollPathIntoView(Path2D* path2d, ExceptionState& exceptionState)
{
if (!path2d) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path2D"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "Path2D"));
return;
}
@@ -1472,7 +1472,7 @@ static bool checkImageSource(CanvasImageSource* imageSource, ExceptionState& exc
{
if (!imageSource) {
// FIXME: Message should mention ImageBitmap once that feature ships.
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, String("HTMLImageElement, HTMLCanvasElement or HTMLVideoElement")));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, String("HTMLImageElement, HTMLCanvasElement or HTMLVideoElement")));
return false;
}
return true;
@@ -1900,7 +1900,7 @@ PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::getImageData(float s
void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionState& exceptionState)
{
if (!data) {
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "ImageData"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "ImageData"));
return;
}
putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionState);
@@ -1910,7 +1910,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
float dirtyWidth, float dirtyHeight, ExceptionState& exceptionState)
{
if (!data)
- exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "ImageData"));
+ exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrectType(1, "ImageData"));
else if (!std::isfinite(dx))
exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::notAFiniteNumber(dx, "dx"));
else if (!std::isfinite(dy))
« no previous file with comments | « LayoutTests/virtual/gpu/fast/canvas/canvas-path-context-stroke-expected.txt ('k') | Source/core/html/canvas/Path2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698