Bug 729126 - Make NS_ABORT_IF_FALSE fire on failure for only some callers of AddCSSValuePixelPercentCalc (the existing ones, and not the new ones added in bug 522607). r=dbaron
authorLazar Sumar <lsumar@mozilla.com>
Thu, 23 Feb 2012 11:40:41 +1300
changeset 90776 adee75f6c42834b5c0ae722060d927886a16a2e6
parent 90775 4679409658090a85da5cf73875de7cec1f10ad04
child 90777 15d7708672c1c5a355c3e647317ad8a4d7211c32
child 90788 d346d9fe51346706cc5c5ae1eb0c235db5efe2c2
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs729126, 522607
milestone13.0a1
Bug 729126 - Make NS_ABORT_IF_FALSE fire on failure for only some callers of AddCSSValuePixelPercentCalc (the existing ones, and not the new ones added in bug 522607). r=dbaron
layout/style/crashtests/729126-1.html
layout/style/crashtests/729126-2.html
layout/style/crashtests/crashtests.list
layout/style/nsStyleAnimation.cpp
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/729126-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body style="-moz-transition-duration: 1ms"></body>
+<script>
+var body = document.body;
+/* flush */ getComputedStyle(body, "").background;
+body.style.background = 'url(none.png), repeat';
+/* flush */ getComputedStyle(body, "").background;
+</script>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/729126-2.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body style="background-size: cover; -moz-transition-duration: 1ms"></body>
+<script>
+var body = document.body;
+/* flush */ getComputedStyle(body, "").backgroundSize;
+body.style.backgroundSize = 'contain';
+/* flush */ getComputedStyle(body, "").backgroundSize;
+</script>
+</html>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -70,8 +70,10 @@ load 645142.html
 load 611922-1.html
 == 645951-1.html 645951-1-ref.html
 load 665209-1.html
 asserts(2) load 671799-1.html
 asserts(2) load 671799-2.html
 load 690990-1.html
 load 696188-1.html
 load 700116.html
+load 729126-1.html
+load 729126-2.html
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -875,22 +875,16 @@ AddCSSValuePixelPercentCalc(const PRUint
                          aResult, aValueRestrictions);
       break;
     case eCSSUnit_Calc:
       AddCSSValueCanonicalCalc(aCoeff1, aValue1,
                                aCoeff2, aValue2,
                                aResult);
       break;
     default:
-      NS_ABORT_IF_FALSE(false,
-                        nsPrintfCString(32,
-                                        "unexpected unit %d, from %d and %d",
-                                        aCommonUnit,
-                                        aValue1.GetUnit(),
-                                        aValue2.GetUnit()).get());
       return false;
   }
 
   return true;
 }
 
 static bool
 AddShadowItems(double aCoeff1, const nsCSSValue &aValue1,
@@ -1817,16 +1811,17 @@ nsStyleAnimation::AddWeighted(nsCSSPrope
       };
       PRUint32 restrictions = nsCSSProps::ValueRestrictions(aProperty);
       for (PRUint32 i = 0; i < 2; ++i) {
         nsCSSValue nsCSSValuePair::*member = pairValues[i];
         if (!AddCSSValuePixelPercentCalc(restrictions, unit[i],
                                          aCoeff1, pair1->*member,
                                          aCoeff2, pair2->*member,
                                          result->*member) ) {
+          NS_ABORT_IF_FALSE(false, "unexpected unit");
           return false;
         }
       }
 
       aResultValue.SetAndAdoptCSSValuePairValue(result.forget(),
                                                 eUnit_CSSValuePair);
       return true;
     }
@@ -1859,16 +1854,17 @@ nsStyleAnimation::AddWeighted(nsCSSPrope
       };
       PRUint32 restrictions = nsCSSProps::ValueRestrictions(aProperty);
       for (PRUint32 i = 0; i < 3; ++i) {
         nsCSSValue nsCSSValueTriplet::*member = tripletValues[i];
         if (!AddCSSValuePixelPercentCalc(restrictions, unit[i],
                                          aCoeff1, &triplet1->*member,
                                          aCoeff2, &triplet2->*member,
                                          result->*member) ) {
+          NS_ABORT_IF_FALSE(false, "unexpected unit");
           return false;
         }
       }
 
       if (result->mZValue.GetUnit() == eCSSUnit_Pixel &&
           result->mZValue.GetFloatValue() == 0.0f) {
         result->mZValue.Reset();
       }