diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 15:42:39 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 15:42:39 +0000 |
commit | ba3996771f6d19298ee655992b2f6291a314ea76 (patch) | |
tree | e5d88f89e7e98aa6ee60af431dc5dfa426d727b2 /chrome/common/extensions | |
parent | 44a91f51ec8dd8d1373e28ef6f3f0ab410db942f (diff) | |
download | chromium_src-ba3996771f6d19298ee655992b2f6291a314ea76.zip chromium_src-ba3996771f6d19298ee655992b2f6291a314ea76.tar.gz chromium_src-ba3996771f6d19298ee655992b2f6291a314ea76.tar.bz2 |
detect preferences errors
BUG=38352
TEST=none
Review URL: http://codereview.chromium.org/1120006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
5 files changed, 10 insertions, 7 deletions
diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 8347381..33cb805 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -117,7 +117,7 @@ Extension* LoadExtension(const FilePath& extension_path, } JSONFileValueSerializer serializer(manifest_path); - scoped_ptr<Value> root(serializer.Deserialize(error)); + scoped_ptr<Value> root(serializer.Deserialize(NULL, error)); if (!root.get()) { if (error->empty()) { // If |error| is empty, than the file could not be read. diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index cd6ad60..a52d4cc 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -250,7 +250,7 @@ static DictionaryValue* LoadMessageFile(const FilePath& locale_path, FilePath file = locale_path.AppendASCII(extension_locale) .Append(Extension::kMessagesFilename); JSONFileValueSerializer messages_serializer(file); - Value *dictionary = messages_serializer.Deserialize(error); + Value *dictionary = messages_serializer.Deserialize(NULL, error); if (!dictionary && error->empty()) { // JSONFileValueSerializer just returns NULL if file cannot be found. It // doesn't set the error, so we have to do it. diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index 37c4696..ad2091e 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -31,7 +31,7 @@ class ManifestTest : public testing::Test { JSONFileValueSerializer serializer(path); scoped_ptr<DictionaryValue> value( - static_cast<DictionaryValue*>(serializer.Deserialize(error))); + static_cast<DictionaryValue*>(serializer.Deserialize(NULL, error))); if (!value.get()) return NULL; diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index fc88ab3..e204dcb 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -50,6 +50,7 @@ TEST(ExtensionTest, InitFromValueInvalid) { FilePath path(FILE_PATH_LITERAL("/foo")); #endif Extension extension(path); + int error_code = 0; std::string error; ExtensionErrorReporter::Init(false); @@ -65,8 +66,10 @@ TEST(ExtensionTest, InitFromValueInvalid) { JSONFileValueSerializer serializer(extensions_path); scoped_ptr<DictionaryValue> valid_value( - static_cast<DictionaryValue*>(serializer.Deserialize(&error))); + static_cast<DictionaryValue*>(serializer.Deserialize(&error_code, + &error))); EXPECT_EQ("", error); + EXPECT_EQ(0, error_code); ASSERT_TRUE(valid_value.get()); ASSERT_TRUE(extension.InitFromValue(*valid_value, true, &error)); ASSERT_EQ("", error); @@ -654,7 +657,7 @@ static Extension* LoadManifest(const std::string& dir, .AppendASCII(test_file); JSONFileValueSerializer serializer(path); - scoped_ptr<Value> result(serializer.Deserialize(NULL)); + scoped_ptr<Value> result(serializer.Deserialize(NULL, NULL)); if (!result.get()) return NULL; diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc index ae2e0e3..dad10f4 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/extension_unpacker.cc @@ -101,7 +101,7 @@ DictionaryValue* ExtensionUnpacker::ReadManifest() { JSONFileValueSerializer serializer(manifest_path); std::string error; - scoped_ptr<Value> root(serializer.Deserialize(&error)); + scoped_ptr<Value> root(serializer.Deserialize(NULL, &error)); if (!root.get()) { SetError(error); return NULL; @@ -281,7 +281,7 @@ bool ExtensionUnpacker::ReadMessageCatalog(const FilePath& message_path) { std::string error; JSONFileValueSerializer serializer(message_path); scoped_ptr<DictionaryValue> root( - static_cast<DictionaryValue*>(serializer.Deserialize(&error))); + static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); if (!root.get()) { std::string messages_file = WideToASCII(message_path.ToWStringHack()); if (error.empty()) { |