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

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

Issue 126074: Change extension id format back to mp-decimal, and change the (Closed)
Patch Set: make all the tests work again Created 11 years, 6 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
Index: chrome/browser/extensions/extensions_service.cc
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 6d99e84f127081516a6d03a947c90220b29315d2..4cad6eb6bf76fcfba1219e004f9fe2289cc676b6 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -440,7 +440,12 @@ void ExtensionsService::GetExternalExtensions(
for (DictionaryValue::key_iterator i = dict->begin_keys();
i != dict->end_keys(); ++i) {
std::wstring key_name = *i;
- DCHECK(Extension::IdIsValid(WideToASCII(key_name)));
+ if (!Extension::IdIsValid(WideToASCII(key_name))) {
+ LOG(WARNING) << "Invalid external extension ID encountered: "
+ << WideToASCII(key_name);
+ continue;
+ }
+
DictionaryValue* extension = NULL;
if (!dict->GetDictionary(key_name, &extension)) {
NOTREACHED();
@@ -574,11 +579,19 @@ void ExtensionsServiceBackend::LoadExtensionsFromInstallDirectory(
extension_path = enumerator.Next()) {
std::string extension_id = WideToASCII(
extension_path.BaseName().ToWStringHack());
+
// The utility process might be in the middle of unpacking an extension, so
// ignore the temp unpacking directory.
if (extension_id == kUnpackExtensionDir)
continue;
+ // Ignore directories that aren't valid IDs.
+ if (!Extension::IdIsValid(extension_id)) {
+ LOG(WARNING) << "Invalid extension ID encountered in extensions "
+ "directory: " << extension_id;
+ continue;
+ }
+
// If there is no Current Version file, just delete the directory and move
// on. This can legitimately happen when an uninstall does not complete, for
// example, when a plugin is in use at uninstall time.
« no previous file with comments | « chrome/browser/extensions/extension_uitest.cc ('k') | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698