Closed Bug 1589270 Opened 5 years ago Closed 5 years ago

Handle Content-Disposition:attachment downloads in the parent process with DocumentChannel

Categories

(Core :: Networking, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla72
Fission Milestone M5
Tracking Status
firefox72 --- fixed

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(3 files, 3 obsolete files)

This is the first piece of bug 1574372. We trigger downloading when explicitly requested (this bug), and also when all the other potential content handlers can't handle the mime type.

This converts the download handler to be able to run directly in the parent, even when the docshell is in a content process.

The rest of bug 1574372 will add support for querying the content handlers for supported types from the parent, such that we can determine if we need to take the fallback download path.

We don't want to fire OnStartRequest to nsDocumentOpenInfo, since that will also trigger content handling and downloads. Just removing from the load group is sufficient, and results in OnStopRequest being sent to the doc shell.

The existing comment here doesn't make much sense, since the doc loader's document channel gets updated on redirects.
I also don't see why we would want the pre-redirect channel. If we get redirected to a download, we should be using the Refresh header from the request that gave us the download, not something earlier that redirected.

This also wouldn't work in the parent processi (since there's no docshell or loader there), which is the only place the Refresh header is ever processed.

Depends on D49526

This also converts MaybeCloseWindowHelper, and results in the window close operations being always run in the parent (even without DocumentChannel).

Depends on D49527

Some extra information:

The current e10s solution for handling this code is that we run nsExternalAppHandler in both the content process and the parent process. We use PExternalHelperApp to forward OnStart/StopRequest etc from the content process instance to the parent process instance.

Some of the actual code only runs in one process or the other though, depending on which QIs succeed.

mOriginalChannel is only set in the content process, since it tries to get the DocLoader.
ProcessAnyRefreshTags only runs in the parent process (called within the actual saving code), but needs mOriginalChannel. I think this is just busted with e10s.
Close window handling only runs in the content process, because we QI to a nsIPropertyBag2 before requesting it, which will only work if we have access to the docshell.
The actual download and save core code only runs in the parent process, due to an explicit XRE_IsContentProcess() check.

The plan here is to eventually only support multi-process downloads via DocumentChannel, and have a single instance of nsExternalAppHandler (and delete PExternalHelperApp).

These patches simplify the two-instance case a bit (like moving window closing to always run in the parent and fixing the refresh header handling, using BrowsingContext), but don't try too hard to clean up the to-be-deleted code.

Priority: -- → P2
Whiteboard: [necko-triaged]
Attachment #9101746 - Attachment description: Bug 1589270 - Part 2: Always set mOriginalChannel using the channel passed to the download handler. → Bug 1589270 - Part 2: Remove support for handling the Refresh header while processing a download.
Attachment #9101748 - Attachment is obsolete: true
Attachment #9101749 - Attachment is obsolete: true
Attachment #9102007 - Attachment is obsolete: true
Keywords: site-compat
Attachment #9101745 - Attachment description: Bug 1589270 - Part 1: Allow passing a specific status when disconnecting the child side, and don't fire OnStart/StopRequest to nsDocumentOpenInfo. → Bug 1589270 - Part 1: Allow passing a specific status when disconnecting the child side, and don't fire OnStart/StopRequest to nsDocumentOpenInfo. r?bzbarsky
Attachment #9101745 - Attachment description: Bug 1589270 - Part 1: Allow passing a specific status when disconnecting the child side, and don't fire OnStart/StopRequest to nsDocumentOpenInfo. r?bzbarsky → Bug 1589270 - Part 1: Allow passing a specific status when disconnecting the child side, but only pass it to nsDocumentOpenInfo, not the load group. r?bzbarsky
Pushed by mwoodrow@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/73f846dfc5b1
Part 1: Allow passing a specific status when disconnecting the child side, but only pass it to nsDocumentOpenInfo, not the load group. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/68bc2ae9b89a
Part 2: Remove support for handling the Refresh header while processing a download. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/baffa8a7b961
Part 3: Convert nsExternalHelperApp to use BrowsingContext instead of nsIInterfaceRequestor. r=bzbarsky
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72

(I’m not going to write a site compatibility note because, as per Matt, it has already been broken since e10s was introduced.)

Keywords: site-compat
Regressions: 1595747

Retroactively moving fixed bugs whose summaries mention "Fission" (or other Fission-related keywords) but are not assigned to a Fission Milestone to an appropriate Fission Milestone.

This will generate a lot of bugmail, so you can filter your bugmail for the following UUID and delete them en masse:

0ee3c76a-bc79-4eb2-8d12-05dc0b68e732

Fission Milestone: --- → M5
Regressions: 1597175
Regressions: 1602366
Regressions: 1605530
Regressions: 1611588
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: