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

Unified Diff: third_party/WebKit/Source/core/dom/DOMMatrix.cpp

Issue 2514453005: DOMMatrix: add missing propagation of exceptions. (Closed)
Patch Set: Created 4 years, 1 month 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: third_party/WebKit/Source/core/dom/DOMMatrix.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
index 731b6f0aedd16e297d8a82d034da7e40ab184885..5ec28a8ebd8505fecf4ab0fb7190ff5026c69ff2 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
@@ -71,10 +71,10 @@ DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D)
DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other,
ExceptionState& exceptionState) {
- validateAndFixup(other, exceptionState);
- if (exceptionState.hadException())
+ if (!validateAndFixup(other, exceptionState)) {
+ DCHECK(exceptionState.hadException());
return nullptr;
-
+ }
if (other.is2D()) {
return new DOMMatrix({other.m11(), other.m12(), other.m21(), other.m22(),
other.m41(), other.m42()},
@@ -115,6 +115,10 @@ void DOMMatrix::setNAN() {
DOMMatrix* DOMMatrix::multiplySelf(DOMMatrixInit& other,
ExceptionState& exceptionState) {
DOMMatrix* otherMatrix = DOMMatrix::fromMatrix(other, exceptionState);
+ if (!otherMatrix) {
+ DCHECK(exceptionState.hadException());
+ return nullptr;
+ }
if (!otherMatrix->is2D())
m_is2D = false;
@@ -126,6 +130,10 @@ DOMMatrix* DOMMatrix::multiplySelf(DOMMatrixInit& other,
DOMMatrix* DOMMatrix::preMultiplySelf(DOMMatrixInit& other,
ExceptionState& exceptionState) {
DOMMatrix* otherMatrix = DOMMatrix::fromMatrix(other, exceptionState);
+ if (!otherMatrix) {
+ DCHECK(exceptionState.hadException());
+ return nullptr;
+ }
if (!otherMatrix->is2D())
m_is2D = false;

Powered by Google App Engine
This is Rietveld 408576698