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

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

Issue 8424005: Loosen error reporting for hosted app permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar test Created 9 years, 2 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/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index ba5753c67923dd1b962baf616f5660b312517018..63b608af516d84da6bf952002dfb03e5d525c207 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -2571,9 +2571,10 @@ bool Extension::ParsePermissions(const DictionaryValue* source,
ExtensionPermissionsInfo::GetInstance()->GetByName(permission_str);
if (permission != NULL) {
- if (!CanSpecifyAPIPermission(permission, error))
+ if (CanSpecifyAPIPermission(permission, error))
+ api_permissions->insert(permission->id());
+ if (!error->empty())
jstritar 2011/10/31 19:16:19 nit: I think you can make this 'else if', but it d
return false;
- api_permissions->insert(permission->id());
continue;
}
@@ -2808,8 +2809,17 @@ bool Extension::CanSpecifyAPIPermission(
if (is_hosted_app()) {
if (!CanSpecifyPermissionForHostedApp(permission)) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kPermissionNotAllowed, permission->name());
+ // Some old versions of Chrome did not return errors here and we ended up
+ // with extensions in the store containing bad data: crbug.com/101993.
+ //
+ // TODO(aa): Consider just being a lot looser when loading and installing
+ // extensions. We can be strict when packing and in development mode. Then
+ // we won't have to maintain all these tricky backward compat issues:
+ // crbug.com/102328.
+ if (creation_flags_ & STRICT_ERROR_CHECKS) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kPermissionNotAllowed, permission->name());
+ }
return false;
}
}
« no previous file with comments | « no previous file | chrome/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698