Commit 2e838469 authored by Minh X. Nguyen's avatar Minh X. Nguyen Committed by Commit Bot

[Extensions] Fix a crash due to race condition in the update service.

Because of a change in the way update client handles extensions that
were remove during the update process UpdateService can crash when
handling update events emitted from UpdateClient.

Bug: 868906, 869663
Change-Id: I78cf5075fab84075f8472edcb2428348794307fe
Reviewed-on: https://chromium-review.googlesource.com/1155749
Commit-Queue: Minh Nguyen <mxnguyen@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581706}
parent 6425ace6
......@@ -136,11 +136,18 @@ void UpdateService::OnEvent(Events event, const std::string& extension_id) {
complete_event = true;
finish_delayed_installation = true;
{
update_client::ErrorCategory error_category =
update_client::ErrorCategory::kNone;
update_client::CrxUpdateItem update_item;
if (!update_client_->GetCrxUpdateState(extension_id, &update_item)) {
NOTREACHED();
if (update_client_->GetCrxUpdateState(extension_id, &update_item)) {
// When update_client_->GetCrxUpdateState(...) returns false, it means
// that |update_client_| can't find any information about this
// |extension_id|. It could be possible that |extension_id| was
// uninstalled when |update_client_| was checking for updates.
// (see bug http://crbug.com/869663).
error_category = update_item.error_category;
}
switch (update_item.error_category) {
switch (error_category) {
case update_client::ErrorCategory::kUpdateCheck:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_CHECK_ERROR,
......
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