Commit 2b4053cd authored by mpcomplete@google.com's avatar mpcomplete@google.com

Fix a browser crash that occurs if the extension unpacker process crashes

after it sends a response to the browser.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113867

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17222 0039d316-1c4b-4281-b951-d872f2087c98
parent b2e05b65
...@@ -98,7 +98,8 @@ class ExtensionsServiceBackend::UnpackerClient ...@@ -98,7 +98,8 @@ class ExtensionsServiceBackend::UnpackerClient
const std::string& expected_id, const std::string& expected_id,
bool from_external) bool from_external)
: backend_(backend), extension_path_(extension_path), : backend_(backend), extension_path_(extension_path),
expected_id_(expected_id), from_external_(from_external) { expected_id_(expected_id), from_external_(from_external),
got_response_(false) {
} }
// Starts the unpack task. We call back to the backend when the task is done, // Starts the unpack task. We call back to the backend when the task is done,
...@@ -143,7 +144,11 @@ class ExtensionsServiceBackend::UnpackerClient ...@@ -143,7 +144,11 @@ class ExtensionsServiceBackend::UnpackerClient
private: private:
// UtilityProcessHost::Client // UtilityProcessHost::Client
virtual void OnProcessCrashed() { virtual void OnProcessCrashed() {
OnUnpackExtensionFailed("Chrome crashed while trying to install"); // Don't report crashes if they happen after we got a response.
if (got_response_)
return;
OnUnpackExtensionFailed("Chrome crashed while trying to install.");
} }
virtual void OnUnpackExtensionSucceeded( virtual void OnUnpackExtensionSucceeded(
...@@ -165,6 +170,10 @@ class ExtensionsServiceBackend::UnpackerClient ...@@ -165,6 +170,10 @@ class ExtensionsServiceBackend::UnpackerClient
// Cleans up our temp directory. // Cleans up our temp directory.
void Cleanup() { void Cleanup() {
if (got_response_)
return;
got_response_ = true;
file_util::Delete(temp_extension_path_.DirName(), true); file_util::Delete(temp_extension_path_.DirName(), true);
Release(); // balanced in Run() Release(); // balanced in Run()
} }
...@@ -190,6 +199,10 @@ class ExtensionsServiceBackend::UnpackerClient ...@@ -190,6 +199,10 @@ class ExtensionsServiceBackend::UnpackerClient
// True if this is being installed from an external source. // True if this is being installed from an external source.
bool from_external_; bool from_external_;
// True if we got a response from the utility process and have cleaned up
// already.
bool got_response_;
}; };
ExtensionsService::ExtensionsService(Profile* profile, ExtensionsService::ExtensionsService(Profile* profile,
......
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