Bug 581579: fix error recovery in parsing of CSS priority suffix. r+a=dbaron
authorZack Weinberg <zweinberg@mozilla.com>
Wed, 04 Aug 2010 12:27:05 -0700
changeset 48866 14039bf83fe4362571bace62b325736f1c17568d
parent 48865 79d6ab3394845924fc0002b318b667aff689f2b2
child 48867 bb1553eca910b39cb6ebf96a957b538ce8f0c79d
push idunknown
push userunknown
push dateunknown
bugs581579
milestone2.0b4pre
Bug 581579: fix error recovery in parsing of CSS priority suffix. r+a=dbaron
layout/reftests/bugs/581579-1-ref.html
layout/reftests/bugs/581579-1.html
layout/reftests/bugs/reftest.list
layout/style/nsCSSParser.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/581579-1-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<style>p { color: black; }</style>
+<p>This text should be black.</p>
+<p>This text should be black.</p>
+<p>This text should be black.</p>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/581579-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<style>p { color: black; }</style>
+<style> #a { color: fuchsia { ; color: red } </style>
+<style> #b { color: fuchsia ! { ; color: red } </style>
+<style> #c { color: fuchsia ! important { ; color: red } </style>
+<p id="a">This text should be black.</p>
+<p id="b">This text should be black.</p>
+<p id="c">This text should be black.</p>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1454,12 +1454,13 @@ random-if(!haveTestPlugin) == 546071-1.h
 == 571347-1b.html 571347-1-ref.html
 == 571347-2a.html 571347-2-ref.html
 == 571347-2b.html 571347-2-ref.html
 == 571347-2c.html 571347-2-ref.html
 == 571347-2d.html 571347-2-ref.html
 == 571347-3.html 571347-3-ref.html
 == 572598-1.html 572598-ref.html
 == 574898-1.html 574898-ref.html
+== 581579-1.html 581579-1-ref.html
 == 584400-dash-length.svg 584400-dash-length-ref.svg
 == 580160-1.html 580160-1-ref.html
 == 579349-1.html 579349-1-ref.html
 == 581317-1.html 581317-1-ref.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -4010,16 +4010,17 @@ CSSParserImpl::ParseDeclaration(css::Dec
       // semicolon is always ok
     } else if (mToken.IsSymbol('}')) {
       // brace is ok if aCheckForBraces, but don't eat it
       UngetToken();
       if (!aCheckForBraces) {
         status = ePriority_Error;
       }
     } else {
+      UngetToken();
       status = ePriority_Error;
     }
   }
 
   if (status == ePriority_Error) {
     if (aCheckForBraces) {
       REPORT_UNEXPECTED_TOKEN(PEBadDeclOrRuleEnd2);
     } else {