Bug 517393 - Crash in GetTransformToElement. r=jwatt
authorRobert Longson <longsonr@gmail.com>
Wed, 07 Oct 2009 14:56:22 +0100
changeset 33628 83f0ff4a941261710456a14024a8af893aa49abe
parent 33627 de9d574b1a4127fc36d1a66b999304875df61b50
child 33629 8edc006c53712cf1e4800ec597bbc8ffafda2474
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs517393
milestone1.9.3a1pre
Bug 517393 - Crash in GetTransformToElement. r=jwatt
content/svg/content/src/nsSVGGraphicElement.cpp
content/svg/content/src/nsSVGSVGElement.cpp
--- a/content/svg/content/src/nsSVGGraphicElement.cpp
+++ b/content/svg/content/src/nsSVGGraphicElement.cpp
@@ -129,20 +129,20 @@ NS_IMETHODIMP nsSVGGraphicElement::GetTr
   *_retval = nsnull;
   nsCOMPtr<nsIDOMSVGMatrix> ourScreenCTM;
   nsCOMPtr<nsIDOMSVGMatrix> targetScreenCTM;
   nsCOMPtr<nsIDOMSVGMatrix> tmp;
   nsCOMPtr<nsIDOMSVGLocatable> target = do_QueryInterface(element, &rv);
   if (NS_FAILED(rv)) return rv;
 
   // the easiest way to do this (if likely to increase rounding error):
-  rv = GetScreenCTM(getter_AddRefs(ourScreenCTM));
-  if (NS_FAILED(rv)) return rv;
-  rv = target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
-  if (NS_FAILED(rv)) return rv;
+  GetScreenCTM(getter_AddRefs(ourScreenCTM));
+  if (!ourScreenCTM) return NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE;
+  target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
+  if (!targetScreenCTM) return NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE;
   rv = targetScreenCTM->Inverse(getter_AddRefs(tmp));
   if (NS_FAILED(rv)) return rv;
   return tmp->Multiply(ourScreenCTM, _retval);  // addrefs, so we don't
 }
 
 //----------------------------------------------------------------------
 // nsIDOMSVGTransformable methods
 /* readonly attribute nsIDOMSVGAnimatedTransformList transform; */
--- a/content/svg/content/src/nsSVGSVGElement.cpp
+++ b/content/svg/content/src/nsSVGSVGElement.cpp
@@ -806,20 +806,20 @@ nsSVGSVGElement::GetTransformToElement(n
   *_retval = nsnull;
   nsCOMPtr<nsIDOMSVGMatrix> ourScreenCTM;
   nsCOMPtr<nsIDOMSVGMatrix> targetScreenCTM;
   nsCOMPtr<nsIDOMSVGMatrix> tmp;
   nsCOMPtr<nsIDOMSVGLocatable> target = do_QueryInterface(element, &rv);
   if (NS_FAILED(rv)) return rv;
 
   // the easiest way to do this (if likely to increase rounding error):
-  rv = GetScreenCTM(getter_AddRefs(ourScreenCTM));
-  if (NS_FAILED(rv)) return rv;
-  rv = target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
-  if (NS_FAILED(rv)) return rv;
+  GetScreenCTM(getter_AddRefs(ourScreenCTM));
+  if (!ourScreenCTM) return NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE;
+  target->GetScreenCTM(getter_AddRefs(targetScreenCTM));
+  if (!targetScreenCTM) return NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE;
   rv = targetScreenCTM->Inverse(getter_AddRefs(tmp));
   if (NS_FAILED(rv)) return rv;
   return tmp->Multiply(ourScreenCTM, _retval);  // addrefs, so we don't
 }
 
 //----------------------------------------------------------------------
 // nsIDOMSVGZoomAndPan methods