diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 22:02:49 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 22:02:49 +0000 |
commit | 99872e3d462aa75e4a73fd943567c38225a45c50 (patch) | |
tree | 42f63ecb7a0f36886441790c3f361be5fc093b6d /chrome/browser/extensions | |
parent | d0437d9953d748fd01b3cc551fc363f793666838 (diff) | |
download | chromium_src-99872e3d462aa75e4a73fd943567c38225a45c50.zip chromium_src-99872e3d462aa75e4a73fd943567c38225a45c50.tar.gz chromium_src-99872e3d462aa75e4a73fd943567c38225a45c50.tar.bz2 |
Actually run directory validation code on install.
BUG=23084
TEST=Install extensions attached to referenced bug. You should get an error dialog, not a crash.
Review URL: http://codereview.chromium.org/244012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_file_util.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/extensions/extension_file_util.cc b/chrome/browser/extensions/extension_file_util.cc index 1692c67..ac34470 100644 --- a/chrome/browser/extensions/extension_file_util.cc +++ b/chrome/browser/extensions/extension_file_util.cc @@ -366,8 +366,8 @@ bool CheckForIllegalFilenames(const FilePath& extension_path, if (reserved_underscore_names.find(filename) == reserved_underscore_names.end()) { *error = StringPrintf( - "Cannot load extension with file or directory name %s." - "Filenames starting with \"_\" are reserved for use by the system", + "Cannot load extension with file or directory name %s. " + "Filenames starting with \"_\" are reserved for use by the system.", filename.c_str()); return false; } diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 28969d2..d380c90 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -715,6 +715,14 @@ TEST_F(ExtensionsServiceTest, InstallExtension) { InstallExtension(path, false); ValidatePrefKeyCount(pref_count); + // Extensions cannot have folders or files that have underscores except ofr in + // certain whitelisted cases (eg _locales). This is an example of a broader + // class of validation that we do to the directory structure of the extension. + // We did not used to handle this correctly for installation. + path = extensions_path.AppendASCII("bad_underscore.crx"); + InstallExtension(path, false); + ValidatePrefKeyCount(pref_count); + // TODO(erikkay): add more tests for many of the failure cases. // TODO(erikkay): add tests for upgrade cases. } |