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; |
} |
} |