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

Unified Diff: chrome/browser/extensions/extension_webrequest_api.cc

Issue 8931006: WebRequest API should warn when a developer attempts to filter URLs without proper permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/browser/extensions/extension_webrequest_api_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_webrequest_api.cc
diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc
index 825c15162aa3007cdfed60a17899d5ee60504094..154b8b0c210c34bcbb4dcdd7a249dca1c34cfe54 100644
--- a/chrome/browser/extensions/extension_webrequest_api.cc
+++ b/chrome/browser/extensions/extension_webrequest_api.cc
@@ -1535,6 +1535,17 @@ bool WebRequestAddEventListener::RunImpl() {
return false;
}
+ // We allow to subscribe to patterns that are broader than the host
+ // permissions. E.g., we could subscribe to http://www.example.com/*
+ // while having host permissions for http://www.example.com/foo/* and
+ // http://www.example.com/bar/*.
+ // For this reason we do only a coarse check here to warn the extension
+ // developer if he does something obviously wrong.
+ if (extension->GetEffectiveHostPermissions().is_empty()) {
+ error_ = keys::kHostPermissionsRequired;
+ return false;
+ }
+
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
profile_id(), extension_id(), extension_name,
event_name, sub_event_name, filter,
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webrequest_api_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698