Commit 280c895a authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

Ignore suggested filename for URLs we can't download

BUG=827083
R=dtrainor@chromium.org

Change-Id: Iffaa3adff0bb82cdeabf9af70a5952e6a50c7079
Reviewed-on: https://chromium-review.googlesource.com/1113447Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570342}
parent 44fad229
...@@ -369,11 +369,10 @@ void HTMLAnchorElement::HandleClick(Event* event) { ...@@ -369,11 +369,10 @@ void HTMLAnchorElement::HandleClick(Event* event) {
: WebFeature:: : WebFeature::
kHTMLAnchorElementDownloadInSandboxWithoutUserGesture); kHTMLAnchorElementDownloadInSandboxWithoutUserGesture);
} }
// TODO(jochen): Only set the suggested filename for URLs we can request.
request.SetSuggestedFilename(
static_cast<String>(FastGetAttribute(downloadAttr)));
if (GetDocument().GetSecurityOrigin()->CanReadContent(completed_url)) { if (GetDocument().GetSecurityOrigin()->CanReadContent(completed_url)) {
// TODO(jochen): Handle cross origin server redirects. // TODO(jochen): Handle cross origin server redirects.
request.SetSuggestedFilename(
static_cast<String>(FastGetAttribute(downloadAttr)));
request.SetRequestContext(WebURLRequest::kRequestContextDownload); request.SetRequestContext(WebURLRequest::kRequestContextDownload);
request.SetRequestorOrigin(SecurityOrigin::Create(GetDocument().Url())); request.SetRequestorOrigin(SecurityOrigin::Create(GetDocument().Url()));
frame->Client()->DownloadURL(request); frame->Client()->DownloadURL(request);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment