Closed Bug 1094130 Opened 10 years ago Closed 10 years ago

DownloadAutoSaveView sometimes does not save 'download'.

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: hiro, Unassigned)

Details

Attachments

(1 file)

DownloadAutoSaveView does not save if the download is finished before cheking of this.onsaveitem() in DownloadStore.save(). Pushed try (not finished yet): https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=ad3ff8be29bd
Blocks: 1092529
Comment on attachment 8517345 [details] [diff] [review] download_shouldPersistDownload_fix.patch The patch seems to work fine on the try.
Attachment #8517345 - Flags: review?(paolo.mozmail)
Comment on attachment 8517345 [details] [diff] [review] download_shouldPersistDownload_fix.patch In Firefox for Desktop, this is by design, because completed downloads are stored in the browser history. You can just add a conditional for Thunderbird and return "true" here to store all downloads forever, which is what the modified code effectively does, or even better follow the B2G conditional path that adds a time limit, so that performance isn't degraded over time by long lists of downloads. While nice to have, a test for the current Firefox and B2G behavior is not required to land this patch. Testing DownloadAutoSaveView directly is tricky and relatively slow, as it is time-dependent, so I suggest you just call shouldPersistDownload on a sample of downloads and check the return value of the function. If you prefer, the tests for the Thunderbid-specific behavior of shouldPersistDownload may just live in comm-central. The production code itself will move outside of mozilla-central once we have a way of registering application-specific DownloadIntegration modules (bug 899013).
Attachment #8517345 - Flags: review?(paolo.mozmail)
Thanks Paolo! I did not know that is an intentional. In that case we can handle it as you suggested. I will write new unit tests to check that download list is surely stored on disk in comm-central. Do you have a plan to add an interface to modify kSaveDelayMs outside the module? It will eliminate the slowness of the tests.
No longer blocks: 1092529
(In reply to Hiroyuki Ikezoe (:hiro) from comment #3) > Do you have a plan to add an interface to modify > kSaveDelayMs outside the module? It will eliminate the slowness of the tests. That's a good idea. We may also use this to write more complete DownloadAutoSaveView tests in mozilla-central, that we need if we add shutdown safety to "downloads.json" using the AsyncShutdown module, that is something we had in mind.
(In reply to :Paolo Amadini from comment #4) > (In reply to Hiroyuki Ikezoe (:hiro) from comment #3) > > Do you have a plan to add an interface to modify > > kSaveDelayMs outside the module? It will eliminate the slowness of the tests. > > That's a good idea. We may also use this to write more complete > DownloadAutoSaveView tests in mozilla-central, that we need if we add > shutdown safety to "downloads.json" using the AsyncShutdown module, that is > something we had in mind. Thanks. Good to know.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: