diff --git a/layout/reftests/w3c-css/submitted/conditional3/css-supports-022.xht b/layout/reftests/w3c-css/submitted/conditional3/css-supports-022.xht
index d12bae1c4355..3cdb63515609 100644
--- a/layout/reftests/w3c-css/submitted/conditional3/css-supports-022.xht
+++ b/layout/reftests/w3c-css/submitted/conditional3/css-supports-022.xht
@@ -1,15 +1,16 @@
- CSS Test: An @supports rule with valid syntax but a failing condition must not apply rules inside it
+ CSS Test: An @supports rule with invalid syntax must not apply rules inside it
-
+
diff --git a/layout/reftests/w3c-css/submitted/conditional3/css-supports-031.xht b/layout/reftests/w3c-css/submitted/conditional3/css-supports-031.xht
index d9bc282bdb8a..1df87995aaf6 100644
--- a/layout/reftests/w3c-css/submitted/conditional3/css-supports-031.xht
+++ b/layout/reftests/w3c-css/submitted/conditional3/css-supports-031.xht
@@ -1,16 +1,15 @@
- CSS Test: {{ brief but unique descriptive title of what's being tested }}
+ CSS Test: An @supports rule with invalid syntax must not apply rules inside it
-
+
diff --git a/layout/reftests/w3c-css/submitted/conditional3/reftest.list b/layout/reftests/w3c-css/submitted/conditional3/reftest.list
index 8d132796180e..bf22315fc069 100644
--- a/layout/reftests/w3c-css/submitted/conditional3/reftest.list
+++ b/layout/reftests/w3c-css/submitted/conditional3/reftest.list
@@ -28,3 +28,4 @@
== css-supports-028.xht pass.html
== css-supports-029.xht pass.html
== css-supports-030.xht pass.html
+== css-supports-031.xht pass.html
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index d7773023d8dc..e15ecbc3f515 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -2487,6 +2487,15 @@ CSSParserImpl::ParseSupportsConditionInParensInsideParens(bool& aConditionMet)
return false;
}
+ if (ExpectSymbol(')', true)) {
+ const PRUnichar *params[] = {
+ propertyName.get()
+ };
+ REPORT_UNEXPECTED_P(PEValueParsingError, params);
+ UngetToken();
+ return false;
+ }
+
nsCSSProperty propID = nsCSSProps::LookupProperty(propertyName,
nsCSSProps::eEnabled);
if (propID == eCSSProperty_UNKNOWN) {