diff --git a/dom/smil/SMILParserUtils.cpp b/dom/smil/SMILParserUtils.cpp index c37d9e48db5a..87b76cbdb78b 100644 --- a/dom/smil/SMILParserUtils.cpp +++ b/dom/smil/SMILParserUtils.cpp @@ -165,7 +165,7 @@ bool ParseClockValue(RangedPtr& aIter, iter = aIter; - int32_t hours = 0, timecount; + int32_t hours = 0, timecount = 0; double fraction = 0.0; uint32_t minutes, seconds, multiplier; @@ -192,7 +192,8 @@ bool ParseClockValue(RangedPtr& aIter, aIter = iter; return true; case TIMECOUNT_VALUE: - if (!SVGContentUtils::ParseInteger(iter, aEnd, timecount)) { + if (*iter != '.' && + !SVGContentUtils::ParseInteger(iter, aEnd, timecount)) { return false; } if (iter != aEnd && *iter == '.' && diff --git a/dom/smil/test/test_smilGetSimpleDuration.xhtml b/dom/smil/test/test_smilGetSimpleDuration.xhtml index a54139a89872..7726950b6332 100644 --- a/dom/smil/test/test_smilGetSimpleDuration.xhtml +++ b/dom/smil/test/test_smilGetSimpleDuration.xhtml @@ -33,6 +33,8 @@ function main() { /* Check basic operation */ anim.setAttribute("dur", "1s"); is(anim.getSimpleDuration(), 1); + anim.setAttribute("dur", ".15s"); + isfuzzy(anim.getSimpleDuration(), 0.15, 0.001); anim.setAttribute("dur", "1.5s"); is(anim.getSimpleDuration(), 1.5); diff --git a/dom/smil/test/test_smilInvalidValues.html b/dom/smil/test/test_smilInvalidValues.html index d6a262fc8d9f..f65d4d7dff9e 100644 --- a/dom/smil/test/test_smilInvalidValues.html +++ b/dom/smil/test/test_smilInvalidValues.html @@ -60,10 +60,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=941315 a.setAttribute("dur", "50s"); is(b.safeGetStartTime(), 50, "valid simple duration"); - // Check an invalid value also causes the model to be updated + // Check invalid values also cause the model to be updated a.setAttribute("dur", "abc"); // -> indefinite is(b.safeGetStartTime(), "none", "invalid simple duration"); + a.setAttribute("dur", "50s"); + a.setAttribute("dur", "-.1s"); // -> indefinite + is(b.safeGetStartTime(), "none", "invalid simple duration"); + // Restore state a.setAttribute("dur", "100s"); }