When downloading mp3 from media document page using webbrowserpersist ("save page as") the request stalls
Categories
(Firefox :: Menus, defect, P3)
Tracking
()
People
(Reporter: tnemp5te7, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0
Steps to reproduce:
Please open in browser following link:
Then right click and click 'Save Page As...' and save the file.
Actual results:
As shown on the screenshot download process does not start and I even cannot cancel it.
Expected results:
To download the file.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::File Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Hello, thank you for the bug report!
In my case, the very first instance of the download fails, but I'm able to cancel and retry downloading again, and the second time the file is downloaded properly and plays properly. This behavior also happens on macOS and Windows.
Could you try running Firefox with a new profile and see if this still happens?
Could you also please attach your about:support? You can do that by going to about:support, click on the "Copy text to clipboard" button, save the data in any text editing tool and attach the file here.
Thank you.
Comment 3•3 years ago
|
||
I can reproduce. I think something is wrong at the http layer level here (or at least, perhaps the downloads code needs to pass different params or something, but then that's going to require help from the networking folks). It looks to me like the download is coalesced to the same request that the media code is making for the same file, and the media code pauses when they've preloaded enough of the file (or something?) and as a result the download also pauses. The amount at which the request stops seems to differ based on how much I let the file load in the media document (before clicking "pause" on the player in the window).
Comment 4•3 years ago
|
||
Here's an HTTP log of a download that stops at about 1.7mb, and that I then cancel, and then me restarting the download with the button in the downloads panel after a few seconds, that loads much more data (and that I then cancel from the user interface as well).
Valentin/Kershaw, any idea what's going on here? I included the media playback preset in the log in case that offers further clues as to what's going on.
Updated•3 years ago
|
Comment 5•3 years ago
|
||
Thanks for the log.
From the log, this is what happened:
- We create the first channel to open the mp3 file.
- When click
Save Page As..the first channel is suspended and never resumed. - We create a second channel to download the file.
- The second channel has
LOAD_FROM_CACHEflag, so it tries to load the data from cache. - Since the first channel is not resumed, it looks like we never have a chance to write the whole file into the cache.
- The second channel only gets partial data from the cache.
I think Valentin knows more about cache than me and he might have a better idea.
Comment 6•3 years ago
|
||
I've started looking into this in bug 1814731 as it seems the problem affects more than this specific issue.
But I'm wondering if it would be acceptable to pass nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY into the load flags in nsWebBrowserPersist::SaveURIInternal?
This would allow us to hit the network when the cache entry we're trying to open is still being written into (and may be suspended indefinitely).
Comment 7•3 years ago
|
||
(In reply to Kershaw Chang [:kershaw] from comment #5)
- When click
Save Page As..the first channel is suspended and never resumed.
Also it might be worth investigating why we're suspending the channel when we attempt to Save it.
Comment 8•3 years ago
|
||
(In reply to Valentin Gosu [:valentin] (he/him) from comment #6)
I've started looking into this in bug 1814731 as it seems the problem affects more than this specific issue.
But I'm wondering if it would be acceptable to passnsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSYinto the load flags innsWebBrowserPersist::SaveURIInternal?
This would allow us to hit the network when the cache entry we're trying to open is still being written into (and may be suspended indefinitely).
I don't know exactly what that flag does (besides what you describe) so it's difficult for me to say if that would break anything. We do appear to pass it in some cases already, cf. https://searchfox.org/mozilla-central/rev/ddbeacddc15008936e8f619c8c3a05fac6eab8d8/browser/base/content/nsContextMenu.js#1952 . So apparently bz answered this 12 years ago (bug 564387 comment 46), but the fix was only applied to context menu + save video as, not to "save page".
If we wanted to be conservative we could only apply this fix for media/img resources, not for e.g. JS/CSS that was linked in <head> and therefore should have loaded already, or something.
Does that answer your question? :-)
Comment 9•3 years ago
|
||
(In reply to :Gijs (he/him) from comment #8)
(In reply to Valentin Gosu [:valentin] (he/him) from comment #6)
If we wanted to be conservative we could only apply this fix for media/img resources, not for e.g. JS/CSS that was linked in<head>and therefore should have loaded already, or something.
I think that is reasonable. Presumably the channel would only be suspended when playing media, so it shouldn't happen in other situations. 👍
Comment 10•3 years ago
|
||
From a very high-level read of these last few comments, it sounds like we might have something actionable here where we can bypass the cache if it's still being written to for more file types. Moving over to the Menus component.
Updated•3 years ago
|
Comment 11•11 months ago
|
||
I think this should have been mitigated by bug 1966494.
Could someone test this out? the link in comment 0 no longer works.
Description
•