Bug 1408310 - Part 1: Fix nsCSSParser if we fail to parse a transform property.
We have to clean nsCSSParserImpl::mTempData up if the current parsing is failed
because this nsCSSParserImpl object may be reused by other nsCSSParers, and the
incorrect status may cause assertions.
MozReview-Commit-ID: 75h0rHzV1Ua
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -1827,16 +1827,17 @@ CSSParserImpl::ParseTransformProperty(co
css::ErrorReporter reporter(scanner, mSheet, mChildLoader, nullptr);
InitScanner(scanner, reporter, nullptr, nullptr, nullptr);
bool parsedOK = ParseTransform(false, eCSSProperty_transform,
aDisallowRelativeValues);
// We should now be at EOF
if (parsedOK && GetToken(true)) {
parsedOK = false;
+ mTempData.ClearProperty(eCSSProperty_transform);
}
bool changed = false;
if (parsedOK) {
declaration->ExpandTo(&mData);
changed = mData.TransferFromBlock(mTempData, eCSSProperty_transform,
EnabledState(), false,
true, false, declaration,
@@ -1845,16 +1846,17 @@ CSSParserImpl::ParseTransformProperty(co
}
if (changed) {
aValue = *declaration->GetNormalBlock()->ValueFor(eCSSProperty_transform);
} else {
aValue.Reset();
}
+ mTempData.AssertInitialState();
ReleaseScanner();
return parsedOK;
}
void
CSSParserImpl::ParseProperty(const nsCSSPropertyID aPropID,
const nsAString& aPropValue,