Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 197033005: Ignore suggested download filename for cross origin links. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revive Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLAnchorElement.cpp
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 08806bc29a44ce5191a315b972796de6b1b9c831..24d9b4d13255a764636ac62e4d34cd69ee73b833 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -394,7 +394,10 @@ void HTMLAnchorElement::handleClick(Event* event)
request.setHTTPReferrer(Referrer(referrer, document().referrerPolicy()));
}
- frame->loader().client()->loadURLExternally(request, NavigationPolicyDownload, fastGetAttribute(downloadAttr));
+ bool isSameOrigin = document().securityOrigin()->canRequest(completedURL);
+ const AtomicString& suggestedName = (isSameOrigin ? fastGetAttribute(downloadAttr) : nullAtom);
+
+ frame->loader().client()->loadURLExternally(request, NavigationPolicyDownload, suggestedName);
} else {
FrameLoadRequest frameRequest(&document(), request, target());
frameRequest.setTriggeringEvent(event);
« no previous file with comments | « LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698