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

Unified Diff: content/browser/download/download_resource_handler.cc

Issue 246893006: [Downloads] Clear suggested filename on cross origin redirect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify use of EmbeddedTestServer 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
Index: content/browser/download/download_resource_handler.cc
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index b02ed3df10bdbead889279c2c8a2016e84233f07..32f372923b38b710ccb2aa3598d2ecd1bd90325a 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -239,6 +239,14 @@ bool DownloadResourceHandler::OnResponseStarted(
info->original_mime_type.clear();
}
+ // Blink verifies that the requester of this download is allowed to set a
+ // suggested name for the security origin of the downlaod URL. However, this
+ // assumption doesn't hold if there were cross origin redirects. Therefore,
+ // clear the suggested_name for such requests.
+ if (info->url_chain.size() > 1 &&
+ info->url_chain.front().GetOrigin() != info->url_chain.back().GetOrigin())
+ info->save_info->suggested_name.clear();
+
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&StartOnUIThread,

Powered by Google App Engine
This is Rietveld 408576698