Bug 1408310 - Part 1: Fix nsCSSParser if we parse transform property failed. draft
authorBoris Chiou <boris.chiou@gmail.com>
Mon, 20 Nov 2017 17:18:28 +0800
changeset 700507 39bc030fc19ec7650e1e8d9a0342e51fab28aa95
parent 700338 dd08f8b19cc32da161811abb2f7093e0f5392e69
child 700508 39c83944bbb5777d3479d819e36c768d09873ba9
push id89871
push userbmo:boris.chiou@gmail.com
push dateMon, 20 Nov 2017 09:30:43 +0000
bugs1408310
milestone59.0a1
Bug 1408310 - Part 1: Fix nsCSSParser if we parse transform property failed. We have to clean nsCSSParserImpl::mTempData up if the current parsing is failed, because this nsCSSParserImpl may be reused by other nsCSSParer, and the incorrect status may cause assertions. MozReview-Commit-ID: 75h0rHzV1Ua
layout/style/nsCSSParser.cpp
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -1837,16 +1837,18 @@ 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);
+    mTempData.AssertInitialState();
   }
 
   bool changed = false;
   if (parsedOK) {
     declaration->ExpandTo(&mData);
     changed = mData.TransferFromBlock(mTempData, eCSSProperty_transform,
                                       EnabledState(), false,
                                       true, false, declaration,