diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index f4ff53af795d..612219caccf5 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -3223,11 +3223,13 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask, } if (eSelectorParsingStatus_Error == parsingStatus) { REPORT_UNEXPECTED_TOKEN(PENegationBadInner); + SkipUntil(')'); return parsingStatus; } // close the parenthesis if (!ExpectSymbol(')', PR_TRUE)) { REPORT_UNEXPECTED_TOKEN(PENegationNoClose); + SkipUntil(')'); return eSelectorParsingStatus_Error; } diff --git a/layout/style/test/test_unclosed_parentheses.html b/layout/style/test/test_unclosed_parentheses.html index 891d99f23ad5..034a8c156d5b 100644 --- a/layout/style/test/test_unclosed_parentheses.html +++ b/layout/style/test/test_unclosed_parentheses.html @@ -137,6 +137,19 @@ var declarations = [ "border-top-width: -moz-calc((2em) ", ]; +var selectors = [ + ":not(", + ":not( ", + ":not(-", + ":not(- ", + ":not(>", + ":not(> ", + ":not(div p", + ":not(div p ", + ":not(div >", + ":not(div > ", +]; + var textNode = document.createTextNode(""); document.getElementById("style").appendChild(textNode); var cs = getComputedStyle(document.getElementById("display"), ""); @@ -152,6 +165,18 @@ for (var i = 0; i < declarations.length; ++i) { "z-index for declaration '" + declarations[i] + "'"); } +for (var i = 0; i < selectors.length; ++i) { + var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" + + "#display { color: green } " + + selectors[i] + " x x x x x x x , #display { color: red } #display { color: red } ) , #display { color: red } " + + "#display { z-index: " + (i + 1) + " }"; + textNode.data = sheet; + is(cs.color, "rgb(0, 128, 0)", + "color for selector '" + selectors[i] + "'"); + is(cs.zIndex, i+1, + "z-index for selector '" + selectors[i] + "'"); +} +