Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: components/bookmarks/browser/bookmark_storage.cc

Issue 2475583002: Adds option for JSON reader to allow invalid utf characters (Closed)
Patch Set: comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/bookmarks/browser/bookmark_storage.cc
diff --git a/components/bookmarks/browser/bookmark_storage.cc b/components/bookmarks/browser/bookmark_storage.cc
index b3f424f577927cd77303c8ddca298c40dd5e49f7..a71c3e3d0dbaeeeb84f3a438025da67a478e0ed3 100644
--- a/components/bookmarks/browser/bookmark_storage.cc
+++ b/components/bookmarks/browser/bookmark_storage.cc
@@ -12,6 +12,7 @@
#include "base/compiler_specific.h"
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
+#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequenced_task_runner.h"
@@ -57,7 +58,10 @@ void LoadCallback(const base::FilePath& path,
bool load_index = false;
bool bookmark_file_exists = base::PathExists(path);
if (bookmark_file_exists) {
- JSONFileValueDeserializer deserializer(path);
+ // Titles may end up containing invalid utf and we shouldn't throw away
+ // all bookmarks if some titles have invalid utf.
+ JSONFileValueDeserializer deserializer(
+ path, base::JSON_REPLACE_INVALID_CHARACTERS);
std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL);
if (root.get()) {
« no previous file with comments | « chromeos/tools/onc_validator/onc_validator.cc ('k') | components/omnibox/browser/search_suggestion_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698