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

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

Issue 2738553002: [Extensions] Log instances of invalid extensions being added (Closed)
Patch Set: . Created 3 years, 9 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/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 7a283b58138b0caa20f76fe9d913e34e5135b120..46ddb77bd244b70ec9440edda53a4dffc945c18c 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -13,6 +13,8 @@
#include <utility>
#include "base/command_line.h"
+#include "base/debug/alias.h"
+#include "base/debug/dump_without_crashing.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
@@ -1481,6 +1483,26 @@ void ExtensionService::OnLoadedInstalledExtensions() {
}
void ExtensionService::AddExtension(const Extension* extension) {
+ if (!Manifest::IsValidLocation(extension->location())) {
+ // TODO(devlin): We should *never* add an extension with an invalid
+ // location, but some bugs (e.g. crbug.com/692069) seem to indicate we do.
+ // Track down the cases when this can happen, and remove this
+ // DumpWithoutCrashing() (possibly replacing it with a CHECK).
+ NOTREACHED();
+ char extension_id_copy[33];
+ base::strlcpy(extension_id_copy, extension->id().c_str(),
+ arraysize(extension_id_copy));
+ Manifest::Location location = extension->location();
+ int creation_flags = extension->creation_flags();
+ Manifest::Type type = extension->manifest()->type();
+ base::debug::Alias(extension_id_copy);
+ base::debug::Alias(&location);
+ base::debug::Alias(&creation_flags);
+ base::debug::Alias(&type);
+ base::debug::DumpWithoutCrashing();
+ return;
+ }
+
// TODO(jstritar): We may be able to get rid of this branch by overriding the
// default extension state to DISABLED when the --disable-extensions flag
// is set (http://crbug.com/29067).

Powered by Google App Engine
This is Rietveld 408576698