mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1223688 - Clear mInSupportsConditions when we error out of CSS.supports() upon finding no tokens. r=dholbert
This commit is contained in:
parent
3dbaca5456
commit
aba9af032b
19
layout/style/crashtests/1223688-1.html
Normal file
19
layout/style/crashtests/1223688-1.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
|
||||
function boom() {
|
||||
CSS.supports('');
|
||||
|
||||
var style = document.createElement("style");
|
||||
var tn = document.createTextNode("* { border: var(--b); }");
|
||||
style.appendChild(tn);
|
||||
document.body.appendChild(style);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
@ -128,6 +128,7 @@ load 1167782-1.html
|
||||
load 1186768-1.xhtml
|
||||
load 1200568-1.html
|
||||
load 1206105-1.html
|
||||
load 1223688-1.html
|
||||
load 1223694-1.html
|
||||
load border-image-visited-link.html
|
||||
load font-face-truncated-src.html
|
||||
|
@ -441,6 +441,31 @@ protected:
|
||||
bool mOriginalValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* RAII class to set aParser->mInSupportsCondition to true and restore it
|
||||
* to false later.
|
||||
*/
|
||||
class MOZ_RAII nsAutoInSupportsCondition
|
||||
{
|
||||
public:
|
||||
explicit nsAutoInSupportsCondition(CSSParserImpl* aParser)
|
||||
: mParser(aParser)
|
||||
{
|
||||
MOZ_ASSERT(!aParser->mInSupportsCondition,
|
||||
"nsAutoInSupportsCondition is not designed to be used "
|
||||
"re-entrantly");
|
||||
mParser->mInSupportsCondition = true;
|
||||
}
|
||||
|
||||
~nsAutoInSupportsCondition()
|
||||
{
|
||||
mParser->mInSupportsCondition = false;
|
||||
}
|
||||
|
||||
private:
|
||||
CSSParserImpl* const mParser;
|
||||
};
|
||||
|
||||
// the caller must hold on to aString until parsing is done
|
||||
void InitScanner(nsCSSScanner& aScanner,
|
||||
css::ErrorReporter& aReporter,
|
||||
@ -4333,7 +4358,7 @@ CSSParserImpl::ParseSupportsRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
||||
bool
|
||||
CSSParserImpl::ParseSupportsCondition(bool& aConditionMet)
|
||||
{
|
||||
mInSupportsCondition = true;
|
||||
nsAutoInSupportsCondition aisc(this);
|
||||
|
||||
if (!GetToken(true)) {
|
||||
REPORT_UNEXPECTED_EOF(PESupportsConditionStartEOF2);
|
||||
@ -4351,7 +4376,6 @@ CSSParserImpl::ParseSupportsCondition(bool& aConditionMet)
|
||||
bool result = ParseSupportsConditionInParens(aConditionMet) &&
|
||||
ParseSupportsConditionTerms(aConditionMet) &&
|
||||
!mScanner->SeenBadToken();
|
||||
mInSupportsCondition = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -4359,12 +4383,10 @@ CSSParserImpl::ParseSupportsCondition(bool& aConditionMet)
|
||||
mToken.mIdent.LowerCaseEqualsLiteral("not")) {
|
||||
bool result = ParseSupportsConditionNegation(aConditionMet) &&
|
||||
!mScanner->SeenBadToken();
|
||||
mInSupportsCondition = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
REPORT_UNEXPECTED_TOKEN(PESupportsConditionExpectedStart);
|
||||
mInSupportsCondition = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user