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

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

Issue 8879011: Make URL filter for web request API mandatory (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/common/extensions/api/extension_api.json » ('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 481c0152450acd92665141281678e0cd0f137c14..9b619bfbb72c4327f784ddc4054c46b844151d0e 100644
--- a/chrome/browser/extensions/extension_webrequest_api.cc
+++ b/chrome/browser/extensions/extension_webrequest_api.cc
@@ -412,6 +412,9 @@ struct ExtensionWebRequestEventRouter::BlockedRequest {
bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue(
const DictionaryValue& value, std::string* error) {
+ if (!value.HasKey("urls"))
+ return false;
+
for (DictionaryValue::key_iterator key = value.begin_keys();
key != value.end_keys(); ++key) {
if (*key == "urls") {
@@ -1489,16 +1492,14 @@ bool WebRequestAddEventListener::RunImpl() {
// Argument 0 is the callback, which we don't use here.
ExtensionWebRequestEventRouter::RequestFilter filter;
- if (HasOptionalArgument(1)) {
- DictionaryValue* value = NULL;
- error_.clear();
- EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &value));
- // Failure + an empty error string means a fatal error.
- EXTENSION_FUNCTION_VALIDATE(filter.InitFromValue(*value, &error_) ||
- !error_.empty());
- if (!error_.empty())
- return false;
- }
+ DictionaryValue* value = NULL;
+ error_.clear();
+ EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &value));
+ // Failure + an empty error string means a fatal error.
+ EXTENSION_FUNCTION_VALIDATE(filter.InitFromValue(*value, &error_) ||
+ !error_.empty());
+ if (!error_.empty())
+ return false;
int extra_info_spec = 0;
if (HasOptionalArgument(2)) {
« no previous file with comments | « no previous file | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698