Bug 1274519 - Don't append result to the candidate list if got unexpected token at the end of size string; r=heycam

MozReview-Commit-ID: 9jwHNUPZ94k
This commit is contained in:
Edgar Chen 2016-05-25 09:47:18 +08:00
Родитель 6be1404013
Коммит 39105e76a9
3 изменённых файлов: 11 добавлений и 42 удалений

Просмотреть файл

@ -245,12 +245,8 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
nsCSSParser cssParser;
if (!cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
mSizeQueries, mSizeValues, true)) {
return false;
}
return mSizeQueries.Length() > 0;
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
mSizeQueries, mSizeValues, true);
}
void

Просмотреть файл

@ -2153,19 +2153,16 @@ CSSParserImpl::ParseSourceSizeList(const nsAString& aBuffer,
break;
}
if (GetToken(true)) {
if (!mToken.IsSymbol(',')) {
REPORT_UNEXPECTED_TOKEN(PEParseSourceSizeListNotComma);
hitError = true;
break;
}
}
aQueries.AppendElement(query.forget());
aValues.AppendElement(value);
if (!GetToken(true)) {
// Expected EOF
break;
}
if (eCSSToken_Symbol != mToken.mType || mToken.mSymbol != ',') {
REPORT_UNEXPECTED_TOKEN(PEParseSourceSizeListNotComma);
hitError = true;
break;
}
}
if (hitError) {
@ -2180,7 +2177,7 @@ CSSParserImpl::ParseSourceSizeList(const nsAString& aBuffer,
ReleaseScanner();
mHTMLMediaMode = false;
return !hitError;
return !aQueries.IsEmpty();
}
bool

Просмотреть файл

@ -165,12 +165,6 @@
[<img srcset="/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w" sizes="not ((max-width:0) or (unknown &quot;general-enclosed&quot;)) 100vw, 1px"> ref sizes="1px" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f33 50w, /images/green-16x16.png?f33 51w" sizes="1px !important"> ref sizes="100vw" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f42 50w, /images/green-16x16.png?f42 51w" sizes="(min-width:0) 1px foo bar"> ref sizes="100vw" (standards mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w" sizes="calc(1px"> ref sizes="100vw" (standards mode)]
expected: FAIL
@ -342,12 +336,6 @@
[<img srcset="/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w" sizes="not ((max-width:0) or (unknown &quot;general-enclosed&quot;)) 100vw, 1px"> ref sizes="1px" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f33 50w, /images/green-16x16.png?f33 51w" sizes="1px !important"> ref sizes="100vw" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f42 50w, /images/green-16x16.png?f42 51w" sizes="(min-width:0) 1px foo bar"> ref sizes="100vw" (quirks mode)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w" sizes="calc(1px"> ref sizes="100vw" (quirks mode)]
expected: FAIL
@ -519,12 +507,6 @@
[<img srcset="/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w" sizes="not ((max-width:0) or (unknown &quot;general-enclosed&quot;)) 100vw, 1px"> ref sizes="1px" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f33 50w, /images/green-16x16.png?f33 51w" sizes="1px !important"> ref sizes="100vw" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f42 50w, /images/green-16x16.png?f42 51w" sizes="(min-width:0) 1px foo bar"> ref sizes="100vw" (display:none)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w" sizes="calc(1px"> ref sizes="100vw" (display:none)]
expected: FAIL
@ -696,12 +678,6 @@
[<img srcset="/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w" sizes="not ((max-width:0) or (unknown &quot;general-enclosed&quot;)) 100vw, 1px"> ref sizes="1px" (width:1000px)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f33 50w, /images/green-16x16.png?f33 51w" sizes="1px !important"> ref sizes="100vw" (width:1000px)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f42 50w, /images/green-16x16.png?f42 51w" sizes="(min-width:0) 1px foo bar"> ref sizes="100vw" (width:1000px)]
expected: FAIL
[<img srcset="/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w" sizes="calc(1px"> ref sizes="100vw" (width:1000px)]
expected: FAIL