Commit 0f57d2f2 authored by finnur@chromium.org's avatar finnur@chromium.org

Fix a crash in the Extension Creator when crx is in use.

BUG=92537
TEST=Create a .crx file from within Chrome, open it up with 7-zip and edit one of the files within (to lock the crx file), then try recreating the crx file -- an error should appear (and no crash).
Review URL: http://codereview.chromium.org/7618044

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96937 0039d316-1c4b-4281-b951-d872f2087c98
parent 3693df59
......@@ -3801,6 +3801,9 @@ are declared in build/common.gypi.
<message name="IDS_EXTENSION_ERROR_WHILE_SIGNING" desc="Warning displayed in pack dialog when occurred an error while signing an extension.">
Error while signing extension.
</message>
<message name="IDS_EXTENSION_SHARING_VIOLATION" desc="Warning displayed in pack dialog when a sharing violation is found during creation of the crx.">
Failed to replace crx file. Check to see if the file is in use.
</message>
<message name="IDS_EXTENSION_PUBLIC_KEY_FAILED_TO_EXPORT" desc="Warning displayed in pack dialog when exporting a public key failed.">
Failed to export public key.
</message>
......
......@@ -192,6 +192,10 @@ bool ExtensionCreator::WriteCRX(const FilePath& zip_path,
if (file_util::PathExists(crx_path))
file_util::Delete(crx_path, false);
ScopedStdioHandle crx_handle(file_util::OpenFile(crx_path, "wb"));
if (!crx_handle.get()) {
error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_SHARING_VIOLATION);
return false;
}
std::vector<uint8> public_key;
if (!private_key->ExportPublicKey(&public_key)) {
......
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