mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 883987 - Don't allow BAD_STRING or BAD_URL tokens in @supports conditions. r=dbaron
This commit is contained in:
parent
3f6239a071
commit
fbf08070fa
4
layout/reftests/bugs/883987-1-ref.html
Normal file
4
layout/reftests/bugs/883987-1-ref.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
</style>
|
8
layout/reftests/bugs/883987-1a.html
Normal file
8
layout/reftests/bugs/883987-1a.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (color: red) or (content: "foo
|
||||
) {
|
||||
body { background: red }
|
||||
}
|
||||
</style>
|
7
layout/reftests/bugs/883987-1b.html
Normal file
7
layout/reftests/bugs/883987-1b.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (color: red) or (content: url("foo" "bar")) {
|
||||
body { background: red }
|
||||
}
|
||||
</style>
|
7
layout/reftests/bugs/883987-1c.html
Normal file
7
layout/reftests/bugs/883987-1c.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (color: red) or (url("foo" "bar")) {
|
||||
body { background: red }
|
||||
}
|
||||
</style>
|
8
layout/reftests/bugs/883987-1d.html
Normal file
8
layout/reftests/bugs/883987-1d.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (color: red) or ("foo
|
||||
) {
|
||||
body { background: red }
|
||||
}
|
||||
</style>
|
8
layout/reftests/bugs/883987-1e.html
Normal file
8
layout/reftests/bugs/883987-1e.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (color: red) or (content: url("foo
|
||||
)) {
|
||||
body { background: red }
|
||||
}
|
||||
</style>
|
7
layout/reftests/bugs/883987-1f.html
Normal file
7
layout/reftests/bugs/883987-1f.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
body { background: green }
|
||||
@supports (not "foo
|
||||
{}
|
||||
body { background: red }
|
||||
</style>
|
@ -1761,3 +1761,9 @@ test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html
|
||||
!= 860370.html 860370-notref.html
|
||||
== 871338-1.html 871338-1-ref.html
|
||||
random-if(Android&&AndroidVersion>=15) == 875060-1.html 875060-1-ref.html #Bug 885303
|
||||
== 883987-1a.html 883987-1-ref.html
|
||||
== 883987-1b.html 883987-1-ref.html
|
||||
== 883987-1c.html 883987-1-ref.html
|
||||
== 883987-1d.html 883987-1-ref.html
|
||||
== 883987-1e.html 883987-1-ref.html
|
||||
== 883987-1f.html 883987-1-ref.html
|
||||
|
@ -2782,17 +2782,21 @@ CSSParserImpl::ParseSupportsCondition(bool& aConditionMet)
|
||||
|
||||
UngetToken();
|
||||
|
||||
mScanner->ClearSeenBadToken();
|
||||
|
||||
if (mToken.IsSymbol('(') ||
|
||||
mToken.mType == eCSSToken_Function ||
|
||||
mToken.mType == eCSSToken_URL ||
|
||||
mToken.mType == eCSSToken_Bad_URL) {
|
||||
return ParseSupportsConditionInParens(aConditionMet) &&
|
||||
ParseSupportsConditionTerms(aConditionMet);
|
||||
ParseSupportsConditionTerms(aConditionMet) &&
|
||||
!mScanner->SeenBadToken();
|
||||
}
|
||||
|
||||
if (mToken.mType == eCSSToken_Ident &&
|
||||
mToken.mIdent.LowerCaseEqualsLiteral("not")) {
|
||||
return ParseSupportsConditionNegation(aConditionMet);
|
||||
return ParseSupportsConditionNegation(aConditionMet) &&
|
||||
!mScanner->SeenBadToken();
|
||||
}
|
||||
|
||||
REPORT_UNEXPECTED_TOKEN(PESupportsConditionExpectedStart);
|
||||
|
@ -352,6 +352,7 @@ nsCSSScanner::nsCSSScanner(const nsAString& aBuffer, uint32_t aLineNumber)
|
||||
, mReporter(nullptr)
|
||||
, mSVGMode(false)
|
||||
, mRecording(false)
|
||||
, mSeenBadToken(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsCSSScanner);
|
||||
}
|
||||
@ -922,6 +923,7 @@ nsCSSScanner::ScanString(nsCSSToken& aToken)
|
||||
continue;
|
||||
}
|
||||
|
||||
mSeenBadToken = true;
|
||||
aToken.mType = eCSSToken_Bad_String;
|
||||
mReporter->ReportUnexpected("SEUnterminatedString", aToken);
|
||||
break;
|
||||
@ -1056,6 +1058,7 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
|
||||
Advance();
|
||||
aToken.mType = eCSSToken_URL;
|
||||
} else {
|
||||
mSeenBadToken = true;
|
||||
aToken.mType = eCSSToken_Bad_URL;
|
||||
}
|
||||
return true;
|
||||
|
@ -141,6 +141,15 @@ class nsCSSScanner {
|
||||
return mSVGMode;
|
||||
}
|
||||
|
||||
// Reset or check whether a BAD_URL or BAD_STRING token has been seen.
|
||||
void ClearSeenBadToken() {
|
||||
mSeenBadToken = false;
|
||||
}
|
||||
|
||||
bool SeenBadToken() const {
|
||||
return mSeenBadToken;
|
||||
}
|
||||
|
||||
// Get the 1-based line number of the last character of
|
||||
// the most recently processed token.
|
||||
uint32_t GetLineNumber() const { return mTokenLineNumber; }
|
||||
@ -221,6 +230,7 @@ protected:
|
||||
// True if we are in SVG mode; false in "normal" CSS
|
||||
bool mSVGMode;
|
||||
bool mRecording;
|
||||
bool mSeenBadToken;
|
||||
};
|
||||
|
||||
#endif /* nsCSSScanner_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user