[Extensions] Fix a crash in ExtensionPrefs
Revision efe0c88679a699f8876fbdff4face5b222d65790 added a check to
verify that extensions that would be loaded in all cases (in order
to fix a crash in ExtensionPrefValueMap). However, this depended on
knowing the type of extension, which was determined by the manifest
(stored in the extension preferences). Unpacked extensions do not
store the manifest, so this caused a crash.
As a workaround, gracefully handle the case of the extension having
no manifest. This is only safe because the only type of extension
that we would still load with extensions disabled is a theme, and
themes do not need entries in ExtensionPrefValueMap. This is a
pretty ugly/hacky solution, but should work to fix the crash.
Also add a regression browser test for the same.
Bug: 836624
Change-Id: Ie7c766ceee261504b1d3f2cc570b7072e71e0f71
Reviewed-on: https://chromium-review.googlesource.com/1035448
Commit-Queue: Devlin <[email protected]>
Reviewed-by: Karan Bhatia <[email protected]>
Cr-Commit-Position: refs/heads/master@{#555123}
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 3f0607c..e6ba0b0 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1206,7 +1206,7 @@
// is set (http://crbug.com/29067).
if (!extensions_enabled_ &&
!Manifest::ShouldAlwaysLoadExtension(extension->location(),
- extension->GetType()) &&
+ extension->is_theme()) &&
disable_flag_exempted_extensions_.count(extension->id()) == 0) {
return;
}