Fix a few intertwined bugs with data URL parsing (double-parsing of the mime type, not fully serializing them, and doubling of charsets in content-type headers)
Categories
(Core :: Networking, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: twisniewski, Assigned: twisniewski)
References
Details
(Whiteboard: [necko-triaged])
Attachments
(1 file)
Basically, we already parse the mime type part of the URL here: https://searchfox.org/mozilla-central/source/netwerk/protocol/data/nsDataChannel.cpp#61
But SetContentType and SetContentCharset at the end of the function will also re-parse the result, using our older parser which isn't saving the parameters of the mime type: https://searchfox.org/mozilla-central/source/netwerk/protocol/data/nsDataChannel.cpp#102-103
We should just set mContentType and mContentCharset in the first line above.
Per spec we should also be serializing the full resulting mimetype here, not just getting its essence: https://searchfox.org/mozilla-central/source/netwerk/protocol/data/nsDataHandler.cpp#189
Finally, the fetch and XHR code doubles-up the charset needlessly in these spots, so we should tell it to only add the charset if it's not already present:
Assignee | ||
Comment 1•1 year ago
•
|
||
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
It turns out that too much Gecko code relies on whatever "content type" happens to mean right now, which is not "whatever is specified by the data url as per the spec", but seems to be more along the lines of the essence of the MimeType (more or less). As such it's too risky to change all of that, so I've taken a new approach:
- update our data url parsing code to follow the spec text more closely to pass these WPTs.
- have it put the full MimeType in a new instance var on the data url channel
- have XHR/fetch use that new value for content-type response headers on data urls.
New try run here: https://treeherder.mozilla.org/jobs?repo=try&revision=657429472db615aa68036814b8e8ead2a51409f5
Assignee | ||
Comment 3•1 year ago
|
||
Updated•1 year ago
|
Comment 5•1 year ago
|
||
Backed out changeset 8d98996f824c (Bug 1845006) for causing build bustage at FetchDriver.cpp
Backout: https://hg.mozilla.org/integration/autoland/rev/23140ddbeb8d9d3b91d2e3111b0e640f249e1c02
Failure log: https://treeherder.mozilla.org/logviewer?job_id=424652254&repo=autoland&lineNumber=9467
Assignee | ||
Comment 6•1 year ago
|
||
Ah, apologies. This is a quick fix I should have caught by rebuilding first after rebasing, then landing. Fix incoming later today.
Comment 8•1 year ago
|
||
Backed out for bustages on nsDataHandler.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/d490ff4c8be402a348becc31bc38bc4bf45193f0
Log link: https://treeherder.mozilla.org/logviewer?job_id=424688770&repo=autoland&lineNumber=31345
Comment 10•1 year ago
|
||
bugherder |
Assignee | ||
Updated•1 year ago
|
Description
•