Firing a non-asynchronous XMLHttpRequest in an asynchronous script causes parsing to hang
Categories
(Core :: DOM: Networking, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox138 | --- | fixed |
People
(Reporter: wbiggs1, Assigned: hsivonen)
References
Details
(Whiteboard: [necko-triaged])
Attachments
(3 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0
Steps to reproduce:
Have a large HTML file that loads in a script asynchronously.
In that script, make an XHR request synchronously (passing in false
for the async argument). It does not matter if that XHR request succeeds or not.
I created a minimum reproducible example: https://github.com/w-biggs/firefox-bug/
The HTML is larger than it really needs to be to reproduce the issue, but it's large enough that it reproduces it very consistently. Much smaller-sized pages will still have this issue sporadically.
Actual results:
The page stops being parsed before the end of the HTML, causing part of the HTML to never get rendered, and Firefox keeps the page in a "loading" state indefinitely. (It will very occasionally parse the whole file before the XHR request fires; doing a hard refresh or disabling cache makes that less likely in my experience.)
This happens despite the fact that the XHR request has completed successfully. (In the network tab, the XHR request shows as completed.)
Expected results:
The page completes parsing, all HTML is rendered, and it doesn't act as if page is still loading indefinitely. This is what happens in other browsers (Chrome, Safari)
Comment 1•8 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Networking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
I tried to do a binary search to find which version of Firefox is the earliest to have this issue but it seems to have existed at least as far back as version 58 (the earliest version that doesn't render as a completely transparent window on my Mac). I'll try later on a Windows machine to see if I can narrow it down any further.
I've put my MRE up on Github Pages so it's easier to test: https://w-biggs.github.io/github-pages/firefox-bug/
Mozregression on Windows narrows the introduction down to a build between the 2023-01-11 and 2023-01-12 builds. I am able to reproduce some version of the issue on Mac as far back as version 58 but it seems to only occur after a hard refresh, so it may be unrelated.
Comment 5•8 months ago
|
||
Based on the description and mozregression output this seems to be a duplicate of bug 1899786.
Randell, this test case seems rather simple. Would you like to include it in bug 1899786?
Comment 6•8 months ago
|
||
The test case is comparable to https://bugzilla.mozilla.org/show_bug.cgi?id=1899786#c16 : start a sync XHR request before a document load completes.
In the STR I provided before, compression was a requirement for reproduction. It is not clear from this description whether the PoC also involved compression.
Comment 7•8 months ago
|
||
The response for https://w-biggs.github.io/github-pages/firefox-bug/ does have content-encoding: gzip
Interestingly, I'm having trouble reproducing from a local copy with npx http-server . -p 8123 -g
I seem to be getting the same behavior regardless of whether a gzip page is being served. Here it is with gzip enabled...
...and here it is with gzip disabled. (The difference in how far the parsing gets before it stops is pretty much due to random chance.)
Comment 10•8 months ago
|
||
If decompression isn't involved, then it's probably not the same.
Updated•8 months ago
|
Comment 11•8 months ago
|
||
The severity field is not set for this bug.
:edgul, could you have a look please?
For more information, please visit BugBot documentation.
Comment 12•8 months ago
|
||
Bug 1899786 has been resolved. Can you still reproduce the problem (without compression)?
Reporter | ||
Comment 13•7 months ago
|
||
I'm still seeing this issue with the latest Firefox Nightly (137.0a1) with or without compression.
Assignee | ||
Comment 14•7 months ago
|
||
This is a duplicate of bug 1938290, right?
Assignee | ||
Comment 15•7 months ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #14)
This is a duplicate of bug 1938290, right?
I suppose this could be left open for the XML case, if I fix only the HTML case in bug 1938290.
Assignee | ||
Comment 16•7 months ago
|
||
Updated•7 months ago
|
Assignee | ||
Comment 17•7 months ago
|
||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 18•6 months ago
|
||
Comment 19•6 months ago
|
||
bugherder |
Description
•