New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 696761 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

LongPress->DownloadLink when started offline reverts to .html file download instead of producing Offline Page

Project Member Reported by dim...@chromium.org, Feb 27 2017

Issue description

Normally, when user does LongPress->DownloadLink on a link that points to the HTML file (aka Web Page), the regular file download starts but after fetching the Content Type header it transfers the job to OfflinePages' RequestCoordinator to continue the full page load and offlining.

However, if that was initiated when device was offline, the initial download/header sniff does not happen right away, instead the download gets paused and on network connection restore and resume it will not go to OfflinePages backend, finishing as a HTML file download.

Expected: to transfer to OfflinePages backend regardless of how started.
 
Owner: dim...@chromium.org
Status: Assigned (was: Untriaged)

Comment 2 by dim...@chromium.org, Mar 22 2017

Issue 700028 has been merged into this issue.

Comment 3 by dim...@chromium.org, Mar 24 2017

Labels: -Hotlist-Fixit
Owner: qin...@chromium.org
THis is where a file download is switched to an offline page download if the headers indicate it's "text/mhtml" resource:


https://cs.chromium.org/chromium/src/chrome/browser/android/offline_pages/downloads/resource_throttle.cc?rcl=f09c3132dafcb61d0ad6b682468c178dace960eb&l=50

For some reason, throttling is not active when the download is woken up on network connect.

Min, is this something you are familiar with?

Comment 4 by dim...@chromium.org, Mar 31 2017

Cc: dim...@chromium.org
BeginDownload (download_manager_impl.cc) may do the download in one of 2 different ways:
1) If there's a valid renderer process associated with the request, like in the case that selecting "Download Link" from a web page, ResourceDispatcherHostImpl will be invoked. We will have a chance to hook up offline_pages::downloads::ResourceThrottle to sniff the response MIME type and trigger the offline download if needed.
2) Otherwise, like in resuming the download from Downloads Home, UrlDownloader will be asked to do the download. There is not any hook to sniff the response.
A possible fix to work for both flows is to rely on the interceptor. We've already attached DownloadRequestData to an URLRequst, but the logic to set and get these data are in DownloadRequestCore. So we need to expose a static method in DownloadRequestCore to determine if the URLRequst has the download data attached.

We already get OfflinePageRequestInterceptor to override MaybeInterceptRequest to serve the offline pages. We just need it to also override MaybeInterceptResponse which will check if the request is a download request. If so, sniff the mime type to trigger the offline download.

One UI note: currently we cancel the existing download and create a new offline download. If Downloads home is opened, you may see an existing download being removed and a new one being added.


Owner: jianli@chromium.org
Status: Started (was: Assigned)

Sign in to add a comment