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

Unified Diff: chrome/common/extensions/manifest.cc

Issue 9705083: Unknown options in extension manifest file are silently ignored (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reduced to a couple lines Created 8 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 | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/manifest.cc
diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc
index 0c55e6b60a422cdd5172c6d45c6304f75c183db5..f6f4ab41ba0585110175921517043e5e59377f3b 100644
--- a/chrome/common/extensions/manifest.cc
+++ b/chrome/common/extensions/manifest.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/string_split.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/extension_error_utils.h"
@@ -27,12 +28,7 @@ Manifest::~Manifest() {
}
void Manifest::ValidateManifest(std::vector<std::string>* warnings) const {
- // Check every feature to see if its in the manifest. Note that this means
- // we will ignore keys that are not features; we do this for forward
- // compatibility.
- // TODO(aa): Consider having an error here in the case of strict error
- // checking to let developers know when they screw up.
-
+ // Check every feature to see if its in the manifest.
std::set<std::string> feature_names =
SimpleFeatureProvider::GetManifestFeatures()->GetAllFeatureNames();
for (std::set<std::string>::iterator feature_name = feature_names.begin();
@@ -49,6 +45,15 @@ void Manifest::ValidateManifest(std::vector<std::string>* warnings) const {
if (result != Feature::IS_AVAILABLE)
warnings->push_back(feature->GetErrorMessage(result));
}
+
+ // Also generate warnings for keys that are not features.
+ for (DictionaryValue::key_iterator key = value_->begin_keys();
+ key != value_->end_keys(); ++key) {
+ if (!SimpleFeatureProvider::GetManifestFeatures()->GetFeature(*key)) {
+ warnings->push_back(base::StringPrintf("Unrecognized manifest key '%s'.",
+ (*key).c_str()));
not at google - send to devlin 2012/05/01 04:04:01 key->c_str()
mitchellwrosen 2012/05/01 04:18:47 But key's a key_iterator, not a std::string*
+ }
+ }
}
bool Manifest::HasKey(const std::string& key) const {
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698