Closed Bug 1274519 Opened 9 years ago Closed 9 years ago

Should not append result to the candidate list if got unexpected token at the end of string when parsing sizes attribute

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

(Whiteboard: btpp-active)

Attachments

(1 file, 2 obsolete files)

CSSParserImpl::ParseSourceSizeList() should not append result to the candidate list if got unexpected token at the end of string when parsing sizes attribute. Some wpt failures in http://w3c-test.org/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html are caused by this bug. for example, <img srcset="/images/green-1x1.png?f33 50w, /images/green-16x16.png?f33 51w" sizes="1px !important"> test expects failing to parse sizes attribute [1] and use default value (100vw), so `/images/green-16x16.png` will be selected. But we parse sizes as `1px` and then select `/images/green-1x1.png`. [1] https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute
Attached patch Patch, v1 (obsolete) — Splinter Review
Whiteboard: btpp-active
Comment on attachment 8754712 [details] [diff] [review] Patch, v1 Review of attachment 8754712 [details] [diff] [review]: ----------------------------------------------------------------- Please see comment #0 for the details, thank you.
Attachment #8754712 - Flags: review?(josh)
Comment on attachment 8754712 [details] [diff] [review] Patch, v1 Review of attachment 8754712 [details] [diff] [review]: ----------------------------------------------------------------- I don't know the CSS parser code at all. From the point of view of the responsive image code, if the API can tell us whether the string was consumed entirely without errors then I think that's all we require.
Attachment #8754712 - Flags: review?(josh) → review?(cam)
Comment on attachment 8754712 [details] [diff] [review] Patch, v1 Review of attachment 8754712 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, thanks. ::: layout/style/nsCSSParser.cpp @@ +2176,5 @@ > CLEAR_ERROR(); > ReleaseScanner(); > mHTMLMediaMode = false; > > + return aQueries.Length() > 0; !aQueries.IsEmpty()
Attachment #8754712 - Flags: review?(cam) → review+
Attachment #8754712 - Attachment is obsolete: true
(Upload correct one) Address review comment #5.
Attachment #8756162 - Attachment is obsolete: true
Attachment #8756166 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: