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

Unified Diff: chrome/browser/extensions/api/management/management_api.cc

Issue 282133008: Don't crash when two extension uninstall prompts are shown at the same time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: error msg Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/management/management_api.cc
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index 86f67ef9684dfffc23e434167800577d11766a4e..9cae566f8df4b9f95de77b7407e81f3fe0fb2b70 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -580,13 +580,24 @@ void ManagementUninstallFunctionBase::SetAutoConfirmForTest(
void ManagementUninstallFunctionBase::Finish(bool should_uninstall) {
if (should_uninstall) {
- bool success = service()->UninstallExtension(
- extension_id_,
- false, /* external uninstall */
- NULL);
+ // The extension can be uninstalled in another window while the UI was
+ // showing. Do nothing in that case.
+ ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile());
+ const Extension* extension = registry->GetExtensionById(
+ extension_id_, ExtensionRegistry::EVERYTHING);
+ if (!extension) {
+ error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError,
+ extension_id_);
+ SendResponse(false);
+ } else {
+ bool success =
+ service()->UninstallExtension(extension_id_,
+ false, /* external uninstall */
+ NULL);
- // TODO set error_ if !success
- SendResponse(success);
+ // TODO set error_ if !success
+ SendResponse(success);
+ }
} else {
error_ = ErrorUtils::FormatErrorMessage(
keys::kUninstallCanceledError, extension_id_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698