Prevents a crash that occurs when multiple ExtensionHost objects point to the same Extension object and then crash (or are killed by the Task manager). Since the first ExtensionHost RenderViewGone will cause the Extension to be unloaded, the subsequent call will try and unload a dirty pointer. This is prevented by NULLing out the Extension pointer in the host and checking it upon RenderViewGone before sending a notification to have it unloaded (again).
TEST=none
BUG=32613,32653
Review URL: http://codereview.chromium.org/555103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37156 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index c1a0a3b4..de75aba 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -845,15 +845,11 @@
std::string extension_id(host->extension()->id());
CHECK(extension_id.length() == 32U);
Extension* extension = GetExtensionById(extension_id, true);
- // It is possible that the extension is already unloaded. If it is not
- // found, then bail. This seems to be Mac-specific caused by the race
- // conditions introduced by Core Animation and Browser Action popups.
- // TODO(andybons): Find out why this is fired twice. http://crbug/32653
- if (!extension)
- return;
-
- // http://crbug.com/30405
CHECK(extension == host->extension());
+ if (!extension) {
+ NOTREACHED();
+ return;
+ }
// Unload the entire extension. We want it to be in a consistent state:
// either fully working or not loaded at all, but never half-crashed.