Commit 1666deef authored by mek@chromium.org's avatar mek@chromium.org

Don't crash when two extension uninstall prompts are shown at the same time.

This adds the same check ExtensionSettingsHandler has in its
ExtensionUninstallAccepted handler to the accepted handler for
chrome.management.uninstall.

BUG=371705

Review URL: https://codereview.chromium.org/282133008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271225 0039d316-1c4b-4281-b951-d872f2087c98
parent 5f83b37c
......@@ -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_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment