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

Issue 610284 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Buried. Ping if important.
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Regression: 'Download as PDF' option is not working on 'www.chromium.org/Home'.

Reported by rk...@etouch.net, May 9 2016

Issue description

Chrome Version: 52.0.2729.0 Revision 7651f94989178a20a2d74d17142493ee67e73892-refs/heads/master@{#392278}(32/64 bit)
OS: Windows (7, 8, 10), Linux (14.04 LTS) and Mac OS X(10.10.5, 10.11.4)

URL: https://sites.google.com/a/chromium.org/dev/Home

What steps will reproduce the problem?
(1) Launch chrome, navigate to above url.
(2) Click on 'Options' icon on video and select 'Download as PDF' or 'Download as PPTX' option, observe.

Nothing is happened after clicking on 'Download as PDF' or 'Download as PPTX' option.

The video should gets download in PDF and PPTX format.

This is a regression issue, broken in 'M-52', below is bisect info:

Good Build: 52.0.2726.0
Bad Build: 52.0.2728.0

Narrow Bisect:
https://chromium.googlesource.com/chromium/src/+log/8214149ca4a39fb54b28e80536aa91edc6ec11ae..76002594fbfb49fc323e81b07531ee66c59ecf99?pretty=fuller&n=100

Suspecting: r392032
 
Actual_Result.mp4
959 KB Download
Expected_Result.mp4
792 KB Download

Comment 1 by mkwst@chromium.org, May 9 2016

Cc: nasko@chromium.org clamy@chromium.org creis@chromium.org
Yes, this is certainly a result of checking `X-Frame-Options` up in the browser process before we actually create a document (https://chromium.googlesource.com/chromium/src/+/26a6fc92ae361b4271f8f2197abe7eb063fc43ed). Looks like we might want to ignore `X-Frame-Options` if we're going to treat the response as a download, though it's not clear to me when we make that decision.

Nasko, Charlie, Camille: Any advice about where that check might be reasonably made? It looks like the decision happens in `MIMETypeResourceHandler`. Would it be enough to move that handler's creation down after the throttle handler's creation in `ResourceDispatcherHostImpl::AddStandardHandlers` (that is, move https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/loader/resource_dispatcher_host_impl.cc&rcl=1462778281&l=1726 to https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/loader/resource_dispatcher_host_impl.cc&rcl=1462778281&l=1758?)

Comment 2 by treib@chromium.org, May 9 2016

Cc: -treib@chromium.org
Labels: ReleaseBlock-Stable
Marking the above issue as RB-Stable as this is a recent regression.

Thank you!

Comment 4 by clamy@chromium.org, May 9 2016

I'm not quite sure. If you move the creation of the ThrottlingResourceHandler after the MIMETypeResourceHandler, this means none of the throttles (this includes SafeBrowsing for example) can execute before the MIMETypeResourceHandler potentially creates extra-state to handle the request. We'd need the opinion of someone from the net stack team I think.

Comment 5 by creis@chromium.org, May 9 2016

Cc: asanka@chromium.org mmenke@chromium.org
Yeah, that sounds risky to me.  Adding asanka@ and mmenke@ for other ideas about comment 1 (i.e., ignoring the newly browser-enforced X-Frame-Options for downloads).

Comment 6 by mkwst@chromium.org, May 10 2016

creis@: Ok. Bypassing SafeBrowsing would be a bad thing indeed. The other option is to special-case the header inside of AncestorThrottle. I can certainly do that; it's a bit hacky, but probably safer.

Comment 7 by asanka@chromium.org, May 10 2016

For navigation initiated downloads, we end up with two sets of throttles. One that's created at RDHI::AddStandardHandlers(), and one that's created at RDHI::CreateResourceHandlerForDownloads(). So the ResourceHandler stack for a navigation initiated download looks like this (in order of ownership):

  1. ThrottlingResourceHandler                       [A]
     
     Contains: NavigationResourceThrottle, <throttles provided by delegate in response to BeginRequest()>, PowerSaveBlockerResourceThrottle, ScheduledResourceRequest.

  2. MimeTypeResourceHandler

  3. ThrottlingResourceHandler                       [B]

     Contains: <throttles provided by delegate in response to DownloadStarting. Excludes standard resource throttles.>

  4. DownloadResourceHandler

Of these, delegate provided standard throttles live in [A].

ChromeResourceDispatcherHostDelegate::DownloadStarting already has the logic in place for adding all the standard throttles to a download request, but it doesn't add them for navigation initiated downloads since those throttles are already present in [A]. However, for explicit download requests (handling of <a download> elements, for instance), [A] would not exist, and the ResourceHandler stack looks like this:

  1. ThrottlingResourceHandler                       [C]

     Contains: <throttles provided by delegate in response to DownloadStarting()>

  2. DownloadResourceHandler

In this case, CRDHD::DownloadStarting() adds all the standard throttles to [C] via CRDHD::AppendStandardResourceThrottles. Hence the delegate provided throttles in [C] would be the union of the delegate provided throttles in [A] and [B].

What's proposed in #1 would cause the ThrottlingResourceHandler at [A] to be discarded by MimeTypeResourceHandler when switching to the alternate RH stack in preparation for a download. Hence all the delegate provided throttles in [A] would need to also exist in [B]. This can be accomplished by having the delegate's DownloadStarting() handler treat navigation initiated downloads the same as explicit downloads. Something that's actually simpler than the current scheme.

One complication of the scheme in #1 would be that for navigation initiated downloads, standard delegate provided throttles would be instantiated twice. Hence the ResourceThrottles would need to not carry state.

Comment 8 by mkwst@chromium.org, May 11 2016

I put up https://codereview.chromium.org/1969743002 as the simplest thing that could possibly work. Is it a reasonable stopgap, or would a deeper refactoring along the lines of #7 be a better solution? If the latter, does anyone have time to do it before the branch? I don't. :)

Comment 9 by mmenke@chromium.org, May 11 2016

I defer to Asanka here, but I don't think it's good enough - it doesn't work for files that are downloaded because of their mimetype (Regardless of whether it's sniffed or non-sniffed).

Comment 10 by nasko@chromium.org, May 11 2016

I think there will be other NavigationThrottle implementations that will benefit from processing after the MimeTypeResouceHandler has had a chance to run. As such, I think it is better to revert this one for now and come up with a solid solution for this before relanding it. Unless someone can indeed land proper fix before branch cut, which is in about 1.5 weeks.
I agree with reverting, though admittedly, I'm not sure what the priority is of shipping X-Frame-Options.  I think enough could go wrong that even if we could get a fix in within 1.5 weeks, that's not enough baking time.
Request someone to an update on the above issue ?

Appreciate the help.

Thank you!
Agree with #9. #8 doesn't handle cases where a response is treated as a download due to the effective Content-Type not being supported by the renderer or any plugins. An unfortunately common way to initiate downloads is to set the Content-Type to something like application/octet-stream. I don't know how common the intersection between that and XFO is, but I'd guess that it's non-trivial.

I'm guessing that the other implementations allow the download in this case?

Comment 14 by creis@chromium.org, May 16 2016

I think mkwst@ might be out this week-- is someone else able to attempt a revert of r392032 before the branch cut?
I'll do the revert.
Actually, I won't.  It doesn't revert cleanly, and I don't have the time to dig through the WebKit code to figure out why.

Comment 17 by mkwst@chromium.org, May 17 2016

Sorry for the delay, I'll take care of it. I'm not entirely here, but I'm here enough.
Project Member

Comment 18 by bugdroid1@chromium.org, May 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/21f43dc397b74d88f8d9d5837c12343b834890e6

commit 21f43dc397b74d88f8d9d5837c12343b834890e6
Author: mkwst <mkwst@chromium.org>
Date: Thu May 19 07:28:12 2016

Revert "Introduce AncestorThrottle, which will process 'X-Frame-Options' headers."

This reverts commit 26a6fc92ae361b4271f8f2197abe7eb063fc43ed, which
broke our handling of 'Content-Disposition' and similar download-triggering
mechanisms for sites like Drive. Which makes me sad.

This revert leaves the new error code in place, as it had already hit the histogram
file, and we want to ensure that it doesn't start meaning something else inbetween
now and the time at which we reland this patch.

Original commit: https://chromium.googlesource.com/chromium/src/+/26a6fc92ae361b4271f8f2197abe7eb063fc43ed

BUG= 610284 , 555418 
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/1988933003
Cr-Commit-Position: refs/heads/master@{#394707}

[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/components/error_page/common/localized_error.cc
[delete] https://crrev.com/8a956ecdb3d8794d1ddb0a4003e818bfbd19ebef/content/browser/frame_host/ancestor_throttle.cc
[delete] https://crrev.com/8a956ecdb3d8794d1ddb0a4003e818bfbd19ebef/content/browser/frame_host/ancestor_throttle.h
[delete] https://crrev.com/8a956ecdb3d8794d1ddb0a4003e818bfbd19ebef/content/browser/frame_host/ancestor_throttle_unittest.cc
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/content/browser/frame_host/navigation_handle_impl.cc
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/content/browser/loader/navigation_resource_throttle.cc
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/content/content_browser.gypi
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/content/content_tests.gypi
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/content/public/browser/navigation_throttle.h
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/LayoutTests/http/tests/inspector/network/x-frame-options-deny-expected.txt
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/LayoutTests/http/tests/inspector/network/x-frame-options-deny.html
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/LayoutTests/http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/LayoutTests/http/tests/security/XFrameOptions/x-frame-options-multiple-headers-conflict-expected.txt
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/LayoutTests/http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny-expected.txt
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/dom/DocumentInit.cpp
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/inspector/InspectorInstrumentationCustomInl.h
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/loader/DocumentLoader.h
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/loader/FrameLoader.cpp
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/loader/FrameLoader.h
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/core/loader/HttpEquiv.h
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
[modify] https://crrev.com/21f43dc397b74d88f8d9d5837c12343b834890e6/third_party/WebKit/Source/platform/network/HTTPParsers.h

Comment 19 by ogres...@gmail.com, May 20 2016

Could you fix it please
Cc: rnimmagadda@chromium.org
Labels: Needs-Feedback
Unable to repro this issue on Windows 7, MAC (10.11.4) & Ubuntu Trusty (14.04) for Google Chrome Canary Version - 52.0.2743.0

Screen-recording is attached.

Looks like this issue is fixed.

@rkote: Could you please confirm the same.

Thank you.
610284.mov
16.2 MB Download

Comment 21 by rk...@etouch.net, May 24 2016

Labels: -Needs-Feedback
With respect to comment 20:

Issue is seems to be fixed in latest canary version 53.0.2746.0

Thank you.
Labels: TE-Verified-53.0.2746.0 TE-Verified-M53
Status: Fixed (was: Assigned)
Thanks for the update.Adding respective labels for the same and updating the status to Fixed.

Sign in to add a comment