nsParser::mIsAboutBlank is incorrectly set with meta refresh
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
People
(Reporter: sefeng, Assigned: hsivonen)
References
Details
Attachments
(1 file)
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-esr115+
diannaS
:
approval-mozilla-esr128+
|
Details | Review |
STR
- Create a
blank.htm
file with<html></html
as the content - Load this snippet with a debug build
<html>
<iframe></iframe>
<script>
const iframe = document.querySelector("iframe");
const meta = iframe.contentDocument.createElement('meta');
meta.httpEquiv = 'Refresh';
meta.content = '0; url=blank.htm';
iframe.contentDocument.head.append(meta);
</script>
</html>
Firefox would crash at https://searchfox.org/mozilla-central/rev/a9d6fb8ae147ebd1ff0d7886fd55c812d9b57378/parser/htmlparser/nsParser.cpp#996. It looks like it set mIsAboutBlank
initially, but didn't update it once meta refresh is appended.
Updated•8 months ago
|
Assignee | ||
Comment 1•7 months ago
|
||
We are not supposed to parse non-about:blank HTML with nsParser
, so we should not be updating mIsAboutBlank
on nsParser
but we should be creating a new nsHtml5Parser
instead. Why does Refresh
cause Necko activity on the nsParser
instance instead of going through nsHTMLDocument::StartDocumentLoad
again? Or does it go through nsHTMLDocument::StartDocumentLoad
again, but the document URL somehow remains at about:blank
instead of blank.htm
so that we create a new parser instance but of the wrong type?
Reporter | ||
Comment 2•7 months ago
|
||
Or does it go through nsHTMLDocument::StartDocumentLoad again, but the document URL somehow remains at about:blank instead of blank.htm so that we create a new parser instance but of the wrong type?
Yeah, this is the case. The url remained at about:blank
at https://searchfox.org/mozilla-central/rev/0c55d51c0d2a9b672e42ad40ea54f90267f92a8e/dom/html/nsHTMLDocument.cpp#343, so a new parse was created.
Assignee | ||
Comment 3•7 months ago
|
||
(In reply to Sean Feng [:sefeng] from comment #2)
The url remained at
about:blank
at https://searchfox.org/mozilla-central/rev/0c55d51c0d2a9b672e42ad40ea54f90267f92a8e/dom/html/nsHTMLDocument.cpp#343, so a new parse was created.
That's very bad. Is GetOriginalURI
wrong and the fix is simply GetURI
?
Assignee | ||
Comment 4•7 months ago
|
||
Perhaps we should also check that the channel QIs to nsIInputStreamChannel
to believe it really is about:blank.
Reporter | ||
Comment 5•7 months ago
|
||
Ah, GetURI returned the correct file URL for me. Do you have cycles to fix this Henri? Let me know if you want me to put up a patch
Assignee | ||
Comment 6•7 months ago
|
||
Assignee | ||
Comment 7•7 months ago
|
||
Let's see if this breaks something else:
https://treeherder.mozilla.org/jobs?repo=try&revision=4c070064b3dbc8abd2806a418272825c156d11f3
Assignee | ||
Updated•7 months ago
|
Comment 9•7 months ago
|
||
bugherder |
Comment 10•6 months ago
|
||
:hsivonen can you nominate this for uplift since it is recommended in https://bugzilla.mozilla.org/show_bug.cgi?id=1753352#c105
Assignee | ||
Comment 11•6 months ago
|
||
Comment on attachment 9418501 [details]
Bug 1910951 - Avoid incorrect use of nsParser when meta refresh is added to about:blank.
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: Bug 1753352 is nominated for uplift, because of a Web compat problem with about:blank. While we don't have in-the-wild Web compat reports about this one, this is another about:blank issue (theoretically could be combined with the other one) that has Web compat problem potential, and this one has a super-simple fix.
- User impact if declined: A particular rather odd way of causing navigation away from the initial about:blank doesn't work, which may theoretically cause site breakage somewhere.
- Fix Landed on Version: 131
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This is a low-risk change, because this should affect only a special case, and that special case has now been tested.
Comment 12•6 months ago
|
||
Comment on attachment 9418501 [details]
Bug 1910951 - Avoid incorrect use of nsParser when meta refresh is added to about:blank.
:hsivonen did you mean esr128?
Assignee | ||
Comment 13•6 months ago
|
||
(In reply to Dianna Smith [:diannaS] from comment #12)
:hsivonen did you mean esr128?
I saw esr115 on bug 1753352, so I used the same flag, but I think esr128 is OK.
Comment 14•6 months ago
|
||
oh youre right, it should be both actually
Updated•6 months ago
|
Comment 15•6 months ago
|
||
Comment on attachment 9418501 [details]
Bug 1910951 - Avoid incorrect use of nsParser when meta refresh is added to about:blank.
Approved for 128.3esr
Comment 16•6 months ago
|
||
uplift |
Updated•6 months ago
|
Comment 17•6 months ago
|
||
Comment on attachment 9418501 [details]
Bug 1910951 - Avoid incorrect use of nsParser when meta refresh is added to about:blank.
Approved for 115.16esr
Comment 18•6 months ago
|
||
uplift |
Updated•6 months ago
|
Comment 19•6 months ago
•
|
||
Backed out of esr115 and esr128 for causing wpt failures , respectively
Failure push
Backout push
Backout link: https://hg.mozilla.org/releases/mozilla-esr115/rev/313021287c789c87cde946407e054e07f44eccad
Failure push
Backout push
Backout link: https://hg.mozilla.org/releases/mozilla-esr128/rev/60c731c9f9a25f54d5d6a438d5e13fc5c12178b6
Comment 20•6 months ago
|
||
uplift |
Updated•6 months ago
|
Comment 21•6 months ago
|
||
uplift |
Updated•6 months ago
|
Description
•