Bug 780337 - @supports rule should not parse if property value is empty. r=dbaron

This commit is contained in:
Cameron McCormack 2012-08-04 17:07:03 +10:00
parent 875b3349b1
commit 7beb9fd997
4 changed files with 17 additions and 7 deletions

View File

@ -1,15 +1,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: An @supports rule with valid syntax but a failing condition must not apply rules inside it</title>
<title>CSS Test: An @supports rule with invalid syntax must not apply rules inside it</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au" />
<link rel="help" href="http://www.w3.org/TR/#at-supports" />
<meta name="flags" content="" />
<meta name="assert" content="A disjunction of two @supports conditions must cause the @supports condition to pass if one condition passes and the other fails due to being an unsupported property with an empty property value."/>
<meta name="assert" content="An @supports conditions must fail to parse if a declaration has an empy property value."/>
<link rel="match" href="pass.html" />
<style type="text/css"><![CDATA[
html { background-color: green }
@supports (unknown:) or (color: green) {
html { background-color: green }
html { background-color: red }
}
]]></style>
</head>

View File

@ -1,16 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: {{ brief but unique descriptive title of what's being tested }}</title>
<title>CSS Test: An @supports rule with invalid syntax must not apply rules inside it</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au" />
<link rel="help" href="http://www.w3.org/TR/#at-supports" />
<meta name="flags" content="" />
<meta name="assert" content="{{ explain precisely what is asserted when the test passes;
optional but helps coordination and review }}" />
<meta name="assert" content="An @supports conditions must fail to parse if a declaration has an empy property value."/>
<link rel="match" href="pass.html" />
<style type="text/css"><![CDATA[
html { background-color: green }
@supports (not (color: rainbow) and (color: green)) {
@supports (color:) or (color: green) {
html { background-color: red }
}
]]></style>

View File

@ -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

View File

@ -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) {