| Index: chrome/browser/extensions/extensions_service.cc
|
| diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
|
| index 5ea1edef51dd2e20dea7d6ae2511f4b0dd7746b1..947e45e5a1e9ce4cb1b0c2125b50f8b934a794a7 100644
|
| --- a/chrome/browser/extensions/extensions_service.cc
|
| +++ b/chrome/browser/extensions/extensions_service.cc
|
| @@ -204,7 +204,7 @@ ExtensionsService::ExtensionsService(Profile* profile,
|
| registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING,
|
| NotificationService::AllSources());
|
| registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED,
|
| - Source<Profile>(profile_));
|
| + NotificationService::AllSources());
|
| prefs->AddPrefObserver(prefs::kExtensionInstallAllowList, this);
|
| prefs->AddPrefObserver(prefs::kExtensionInstallDenyList, this);
|
|
|
| @@ -1358,7 +1358,8 @@ void ExtensionsService::Observe(NotificationType type,
|
| }
|
|
|
| case NotificationType::EXTENSION_PROCESS_TERMINATED: {
|
| - DCHECK_EQ(profile_, Source<Profile>(source).ptr());
|
| + if (profile_ != Source<Profile>(source).ptr()->GetOriginalProfile())
|
| + break;
|
|
|
| ExtensionHost* host = Details<ExtensionHost>(details).ptr();
|
|
|
| @@ -1377,7 +1378,11 @@ void ExtensionsService::Observe(NotificationType type,
|
|
|
| // 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.
|
| - UnloadExtension(host->extension()->id());
|
| + // We do it in a PostTask so that other handlers of this notification will
|
| + // still have access to the Extension and ExtensionHost.
|
| + MessageLoop::current()->PostTask(FROM_HERE,
|
| + NewRunnableMethod(this, &ExtensionsService::UnloadExtension,
|
| + host->extension()->id()));
|
| break;
|
| }
|
|
|
|
|