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

Unified Diff: chrome/browser/download/download_extension_api.cc

Issue 10213002: Make downloads.download() respect host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 7 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 | « no previous file | chrome/test/data/extensions/api_test/downloads/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_extension_api.cc
diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc
index cdf0193ff2ef33882e4c8323ea762f597ede8def..a892675b3302abb791ead56b385dfe2b6b9f007a 100644
--- a/chrome/browser/download/download_extension_api.cc
+++ b/chrome/browser/download/download_extension_api.cc
@@ -380,6 +380,13 @@ bool DownloadsDownloadFunction::ParseArgs() {
return false;
}
+ if (!iodata_->url.SchemeIs("data") &&
Aaron Boodman 2012/05/14 21:32:13 Is there a use case for downloading a data URL?
benjhayden 2012/05/15 17:47:01 Many websites use data URLs for images, and an ext
+ iodata_->url.GetOrigin() != GetExtension()->url().GetOrigin() &&
+ !GetExtension()->HasHostPermission(iodata_->url)) {
+ error_ = download_extension_errors::kInvalidURLError;
+ return false;
+ }
+
if (options->HasKey(kFilenameKey)) {
EXTENSION_FUNCTION_VALIDATE(options->GetString(
kFilenameKey, &iodata_->filename));
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/downloads/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698