Override download target folder with "browser.setDownloadBehavior" before temporary download file is created
Categories
(Remote Protocol :: WebDriver BiDi, task, P2)
Tracking
(firefox152 fixed)
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: Sasha, Assigned: Sasha)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [webdriver:m20][webdriver:relnote])
Attachments
(3 files)
The implementation of browser.setDownloadBehavior on the bug 1989022 introduces a workaround to update the target folder for a download when the download is already started; as a consequence, this requires cleaning up all the partial data downloaded at that time.
Unfortunately, introducing an earlier hook at the JS level wouldn't be sufficient here because at the time the download is created in the JS layer (which is only serializing the platform data to a JS object), there is already a temporary file created.
So it looks like to really avoid the cleanup, we have to interfere much earlier in the platform layer. One idea could be to attach an override download folder to a browsing context object and access it when the decision about the download target folder has to be made (somewhere around here).
One of the limitations of the workaround is:
If you try to download file.txt and the "default" download folder already has a file with the same name, it will be downloaded to the new folder as file(1).txt, and subsequent downloads will then be called file(1)(1).txt, file(1)(2).txt, etc... Because the download logic already modified the filename by using DownloadPaths.createNiceUniqueFile.
Comment 1•5 months ago
|
||
Another limitation of the workaround is that the temporary file won't get cleaned up if the browser dies, so this Playwright test leaves file.txt in the user's Downloads folder (and subsequent tests trying to download file.txt will receive file(1).txt).
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 2•4 months ago
|
||
Let's rereview the priority when we do the planning for M20.
| Assignee | ||
Updated•4 months ago
|
Updated•3 months ago
|
| Assignee | ||
Updated•3 months ago
|
| Assignee | ||
Comment 3•3 months ago
|
||
| Assignee | ||
Comment 4•3 months ago
|
||
| Assignee | ||
Comment 5•3 months ago
|
||
Comment 7•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b84a84bbee6c
https://hg.mozilla.org/mozilla-central/rev/1c0fd54c623c
https://hg.mozilla.org/mozilla-central/rev/297d38e1c9be
Description
•