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()) { |