Previously, this was passed around using the nsHashPropertyBag base
class on HTTP channels. In bug 1907269, this base was added to
nsExtProtocolChannel to support reading this property for external
protocols.
This unfortunately ended up not working when a HTTP channel redirects to
an external protocol, as the hash property propagation logic in
nsHttpChannel happens after the check that the target channel is a HTTP
channel, so the property was lost when redirecting to an external
protocol.
Rather than refactoring HTTP redirect logic, this patch simplifies by
moving the property onto the LoadInfo where it will be trivially
preserved across redirects, and available in the places which need it.
Because the nsHashPropertyBag base is no longer required for
nsExtProtocolChannel, it is also removed.
Differential Revision: https://phabricator.services.mozilla.com/D220744
Previously this load would be allowed due to the "web-controlled" check
failing to reject the load. This patch instead bases it on the
docshell.newWindowTarget flag, which is set for the first load in a new
DocShell due to a call to window.open or target=_blank.
This required making the external protocol channel be a property bag so
that the flag can be set on the channel. In the future we may want to
switch this flag to being set in a more generic way which is less
specific to the channel.
Differential Revision: https://phabricator.services.mozilla.com/D217484
Previously this load would be allowed due to the "web-controlled" check
failing to reject the load. This patch instead bases it on the
docshell.newWindowTarget flag, which is set for the first load in a new
DocShell due to a call to window.open or target=_blank.
This required making the external protocol channel be a property bag so
that the flag can be set on the channel. In the future we may want to
switch this flag to being set in a more generic way which is less
specific to the channel.
Differential Revision: https://phabricator.services.mozilla.com/D217484
We can pass over the localized error message from nsExternalHelperAppService to
the downloads UI and show it to the user. That may help the user figuring out
why the download failed.
For now long messages are delegated to the tooltip.
Differential Revision: https://phabricator.services.mozilla.com/D217317
`char16_t` and `wchar_t` are functionally the same on Windows. But logging statements do not handle `char16_t` very well, resulting in the need to static cast to `wchar_t`. For more info, see [[ https://bugzilla.mozilla.org/show_bug.cgi?id=1768758 | bug task ]]:
This diff introduces a Windows-specific function for getting strings as `wchar_t` and replaces previous workaround usages.
Differential Revision: https://phabricator.services.mozilla.com/D215869
Fire a signal (via the observer service) when the file-dialog crashes or
otherwise fails.
Set up a listener for that signal which reports the failure to the
end-user via the NotificationBox.
Differential Revision: https://phabricator.services.mozilla.com/D214192
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`.
Differential Revision: https://phabricator.services.mozilla.com/D214189
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 ("Download**s**Directory") is intentional
to match the name of its coordinate function in DownloadIntegration.
No functional changes.
Differential Revision: https://phabricator.services.mozilla.com/D214656
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.
Differential Revision: https://phabricator.services.mozilla.com/D214655
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.
Differential Revision: https://phabricator.services.mozilla.com/D214651