Add new method `GetPreferredDownloadsDirectory()` to `nsIExternalHelperAppService`
Categories
(Firefox :: File Handling, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox130 | --- | fixed |
People
(Reporter: rkraesig, Assigned: rkraesig)
References
Details
Attachments
(7 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
As discussed in D214189, refactor GetDownloadDirectory()
in nsExternalHelperAppService.cpp
, and expose a slice of its functionality as an XPCOM method in support of bug 1884426.
(This should also allow us to write a test for the hitherto-untested requirement that it (conditionally) has the same output as DownloadIntegration.getPreferredDownloadsDirectory()
.)
Assignee | ||
Comment 1•9 months ago
|
||
This greatly simplifies future refactorings, mostly by obviating
dir.forget(_directory)
.
There is one deliberate functional change: in SetDownloadToLaunch()
,
we now check the error-return value of GetDownloadDirectory()
and
abort if it failed, rather than proceeding.
Assignee | ||
Comment 2•9 months ago
|
||
Scope dir
more tightly; return early when possible.
No functional changes.
Assignee | ||
Comment 3•9 months ago
|
||
No functional changes.
Assignee | ||
Comment 4•9 months ago
|
||
No functional changes.
Assignee | ||
Comment 5•9 months ago
|
||
Scope various temporary variables more tightly. Remove unneeded
conditionals.
There is one minor functional change: we no longer abort entirely if
bundleService
could not be acquired, but instead fall back to just
using the unlocalized string.
Assignee | ||
Comment 6•9 months ago
|
||
Split GetDownloadDirectory
into GetInitialDownloadDirectory
and
GetPreferredDownloadsDirectory
. (The latter is named for the function
in DownloadIntegration.sys.mjs whose behavior it should match.)
Unlike previous refactors in the patchset, when considered in isolation,
this patch doesn't really improve the code; it's just a necessary
prerequisite for exposing the function for use elsewhere.
The naming inconsistency here ("DownloadsDirectory") is intentional
to match the name of its coordinate function in DownloadIntegration.
No functional changes.
Assignee | ||
Comment 7•9 months ago
|
||
nsIExternalHelperAppService computes, but does not expose, the preferred
downloads directory's location. Expose it, for use by default-save-location
fallback code when the file-dialog fails.
Additionally, add a test to confirm that the value produced by this
method is, as the comment nearby implies, the same as that produced by
the eponymous method on DownloadIntegration
.
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•8 months ago
|
Comment 9•8 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1f300b099684
https://hg.mozilla.org/mozilla-central/rev/12b29c64833c
https://hg.mozilla.org/mozilla-central/rev/e5af096e1328
https://hg.mozilla.org/mozilla-central/rev/3f3f570423a5
https://hg.mozilla.org/mozilla-central/rev/42bf1f9c360a
https://hg.mozilla.org/mozilla-central/rev/6b78f7a15420
https://hg.mozilla.org/mozilla-central/rev/1bf3d72d31d2
Description
•