зеркало из https://github.com/mozilla/gecko-dev.git
Fix places where we should skip to a closing parenthesis during errors parsing functions. (Bug 575672) r=bzbarsky a2.0=blocking2.0+
This commit is contained in:
Родитель
a286bcfd04
Коммит
f88364d08c
|
@ -1309,6 +1309,7 @@ CSSParserImpl::GetURLInParens(nsString& aURL)
|
|||
NS_ASSERTION(!mHavePushBack, "mustn't have pushback at this point");
|
||||
do {
|
||||
if (! mScanner.NextURL(mToken)) {
|
||||
// EOF
|
||||
return PR_FALSE;
|
||||
}
|
||||
} while (eCSSToken_WhiteSpace == mToken.mType);
|
||||
|
@ -3615,7 +3616,8 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
aValue.SetColorValue(NS_RGB(r,g,b));
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE; // already pushed back
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (mToken.mIdent.LowerCaseEqualsLiteral("-moz-rgba") ||
|
||||
mToken.mIdent.LowerCaseEqualsLiteral("rgba")) {
|
||||
|
@ -3629,7 +3631,8 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
aValue.SetColorValue(NS_RGBA(r, g, b, a));
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE; // already pushed back
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (mToken.mIdent.LowerCaseEqualsLiteral("hsl")) {
|
||||
// hsl ( hue , saturation , lightness )
|
||||
|
@ -3638,6 +3641,7 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
aValue.SetColorValue(rgba);
|
||||
return PR_TRUE;
|
||||
}
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (mToken.mIdent.LowerCaseEqualsLiteral("-moz-hsla") ||
|
||||
|
@ -3652,6 +3656,7 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||
NS_GET_B(rgba), a));
|
||||
return PR_TRUE;
|
||||
}
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -4474,12 +4479,20 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
|||
if (((aVariantMask & VARIANT_ATTR) != 0) &&
|
||||
(eCSSToken_Function == tk->mType) &&
|
||||
tk->mIdent.LowerCaseEqualsLiteral("attr")) {
|
||||
return ParseAttr(aValue);
|
||||
if (!ParseAttr(aValue)) {
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariantMask & VARIANT_CUBIC_BEZIER) != 0) &&
|
||||
(eCSSToken_Function == tk->mType)) {
|
||||
if (tk->mIdent.LowerCaseEqualsLiteral("cubic-bezier")) {
|
||||
return ParseTransitionTimingFunctionValues(aValue);
|
||||
if (!ParseTransitionTimingFunctionValues(aValue)) {
|
||||
SkipUntil(')');
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariantMask & VARIANT_CALC) &&
|
||||
|
|
|
@ -175,6 +175,7 @@ _TEST_FILES = test_acid3_test46.html \
|
|||
test_transitions_per_property.html \
|
||||
test_transitions_dynamic_changes.html \
|
||||
test_transitions_bug537151.html \
|
||||
test_unclosed_parentheses.html \
|
||||
test_units_angle.html \
|
||||
test_units_frequency.html \
|
||||
test_units_length.html \
|
||||
|
|
|
@ -1031,7 +1031,10 @@ var gCSSProperties = {
|
|||
"-moz-repeating-radial-gradient(top left 99deg, cover, red, blue)",
|
||||
"-moz-repeating-radial-gradient(15% 20% -1.2345rad, circle, red, blue)",
|
||||
"-moz-repeating-radial-gradient(45px 399grad, ellipse closest-corner, red, blue)",
|
||||
"-moz-repeating-radial-gradient(45px 399grad, farthest-side circle, red, blue)"
|
||||
"-moz-repeating-radial-gradient(45px 399grad, farthest-side circle, red, blue)",
|
||||
"-moz-image-rect(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), 2, 10, 10, 2)",
|
||||
"-moz-image-rect(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), 10%, 50%, 30%, 0%)",
|
||||
"-moz-image-rect(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), 10, 50%, 30%, 0)",
|
||||
],
|
||||
invalid_values: [
|
||||
/* Old syntax */
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=575672
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 575672</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<style type="text/css" id="style"></style>
|
||||
<style type="text/css">
|
||||
#display { position: relative }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=575672">Mozilla Bug 575672</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for unclosed parentheses in CSS values. **/
|
||||
|
||||
// Each of the following declarations should have a single missing ')'
|
||||
// in the value.
|
||||
var declarations = [
|
||||
"content: url(",
|
||||
"content: url( ",
|
||||
"content: url(http://www.foo.com",
|
||||
"content: url('http://www.foo.com'",
|
||||
"background-image: -moz-linear-gradient(",
|
||||
"background-image: -moz-linear-gradient( ",
|
||||
"background-image: -moz-linear-gradient(red, blue",
|
||||
"background-image: -moz-linear-gradient(red, yellow, blue",
|
||||
"background-image: -moz-linear-gradient(red 1px, yellow 5px, blue 10px",
|
||||
"background-image: -moz-linear-gradient(red, yellow, rgb(0, 0, 255)",
|
||||
"background-image: -moz-repeating-linear-gradient(top left, red, blue",
|
||||
"background-image: -moz-linear-gradient(top left, red, yellow, blue",
|
||||
"background-image: -moz-linear-gradient(top left, red 1px, yellow 5px, blue 10px",
|
||||
"background-image: -moz-linear-gradient(top left, red, yellow, rgb(0, 0, 255)",
|
||||
"background-image: -moz-radial-gradient(",
|
||||
"background-image: -moz-radial-gradient( ",
|
||||
"background-image: -moz-radial-gradient(top left 45deg, red, blue",
|
||||
"background-image: -moz-radial-gradient(cover, red, blue",
|
||||
"background-image: -moz-repeating-radial-gradient(circle, red, blue",
|
||||
"background-image: -moz-radial-gradient(ellipse closest-corner, red, hsl(240, 50%, 50%)",
|
||||
"background-image: -moz-radial-gradient(farthest-side circle, red, blue",
|
||||
"background-image: -moz-image-rect(",
|
||||
"background-image: -moz-image-rect( ",
|
||||
"background-image: -moz-image-rect(url(foo.jpg)",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10 ",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10,",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, ",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10 ",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10,",
|
||||
"background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10, ",
|
||||
"color: rgb(",
|
||||
"color: rgb( ",
|
||||
"color: rgb(128, 0",
|
||||
"color: rgb(128, 0, 128",
|
||||
"color: rgb(128, 0, 128, 128",
|
||||
"color: rgba(",
|
||||
"color: rgba( ",
|
||||
"color: rgba(128, 0",
|
||||
"color: rgba(128, 0, 128",
|
||||
"color: rgba(128, 0, 128, 1",
|
||||
"color: rgba(128, 0, 128, 1, 1",
|
||||
"color: hsl(",
|
||||
"color: hsl( ",
|
||||
"color: hsl(240, 50%",
|
||||
"color: hsl(240, 50%, 50%",
|
||||
"color: hsl(240, 50%, 50%, 50%",
|
||||
"color: hsla(",
|
||||
"color: hsla( ",
|
||||
"color: hsla(240, 50%",
|
||||
"color: hsla(240, 50%, 50%",
|
||||
"color: hsla(240, 50%, 50%, 1",
|
||||
"color: hsla(240, 50%, 50%, 1, 1",
|
||||
"content: counter(",
|
||||
"content: counter( ",
|
||||
"content: counter(foo",
|
||||
"content: counter(foo ",
|
||||
"content: counter(foo,",
|
||||
"content: counter(foo, ",
|
||||
"content: counter(foo, upper-roman",
|
||||
"content: counter(foo, upper-roman ",
|
||||
"content: counter(foo, upper-roman,",
|
||||
"content: counter(foo, upper-roman, ",
|
||||
"content: counters(",
|
||||
"content: counters( ",
|
||||
"content: counters(foo, ','",
|
||||
"content: counters(foo, ',' ",
|
||||
"content: counters(foo, ',',",
|
||||
"content: counters(foo, ',', ",
|
||||
"content: counters(foo, ',', upper-roman",
|
||||
"content: counters(foo, ',', upper-roman ",
|
||||
"content: counters(foo, ',', upper-roman,",
|
||||
"content: counters(foo, ',', upper-roman, ",
|
||||
"content: attr(",
|
||||
"content: attr( ",
|
||||
"content: attr(href",
|
||||
"content: attr(href ",
|
||||
"content: attr(html",
|
||||
"content: attr(html ",
|
||||
"content: attr(html|",
|
||||
"content: attr(html| ",
|
||||
"content: attr(html|href",
|
||||
"content: attr(html|href ",
|
||||
"content: attr(|",
|
||||
"content: attr(| ",
|
||||
"content: attr(|href",
|
||||
"content: attr(|href ",
|
||||
"-moz-transition-timing-function: cubic-bezier(",
|
||||
"-moz-transition-timing-function: cubic-bezier( ",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1 ",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1,",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1, ",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1, 1",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1, 1 ",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1, 1,",
|
||||
"-moz-transition-timing-function: cubic-bezier(0, 0, 1, 1, ",
|
||||
"border-top-width: -moz-calc(",
|
||||
"border-top-width: -moz-calc( ",
|
||||
"border-top-width: -moz-calc(2em",
|
||||
"border-top-width: -moz-calc(2em ",
|
||||
"border-top-width: -moz-calc(2em +",
|
||||
"border-top-width: -moz-calc(2em + ",
|
||||
"border-top-width: -moz-calc(2em *",
|
||||
"border-top-width: -moz-calc(2em * ",
|
||||
"border-top-width: -moz-calc((2em)",
|
||||
"border-top-width: -moz-calc((2em) ",
|
||||
];
|
||||
|
||||
var textNode = document.createTextNode("");
|
||||
document.getElementById("style").appendChild(textNode);
|
||||
var cs = getComputedStyle(document.getElementById("display"), "");
|
||||
|
||||
for (var i = 0; i < declarations.length; ++i) {
|
||||
var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" +
|
||||
"#display { color: green; " + declarations[i] +
|
||||
" x x x x x x x ; color: red; ) ; z-index: " + (i + 1) + " }";
|
||||
textNode.data = sheet;
|
||||
is(cs.color, "rgb(0, 128, 0)",
|
||||
"color for declaration '" + declarations[i] + "'");
|
||||
is(cs.zIndex, i+1,
|
||||
"z-index for declaration '" + declarations[i] + "'");
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче