diff options
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.cc | 8 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.h | 2 | ||||
-rw-r--r-- | chrome/test/data/firefox3_pref.js | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index c72aa7f..9959502 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -426,7 +426,13 @@ bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs) { // Value could be a string. if (value.size() >= 2U && value[0] == '"' && value[value.size() - 1] == '"') { - prefs->SetString(ASCIIToWide(key), value.substr(1, value.size() - 2)); + value = value.substr(1, value.size() - 2); + // ValueString only accept valid UTF-8. Simply ignore that entry if it is + // not UTF-8. + if (IsStringUTF8(value)) + prefs->SetString(ASCIIToWide(key), value); + else + LOG(INFO) << "Non UTF8 value for key " << key << ", ignored."; continue; } diff --git a/chrome/browser/importer/firefox_importer_utils.h b/chrome/browser/importer/firefox_importer_utils.h index c97833f..1ad7ddb 100644 --- a/chrome/browser/importer/firefox_importer_utils.h +++ b/chrome/browser/importer/firefox_importer_utils.h @@ -90,6 +90,8 @@ bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path); // in |prefs|. Keys are strings, and values can be strings, booleans or // integers. Returns true if it succeeded, false otherwise (in which case // |prefs| is not filled). +// Note: for strings, only valid UTF-8 string values are supported. If a +// key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|. bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs); #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ diff --git a/chrome/test/data/firefox3_pref.js b/chrome/test/data/firefox3_pref.js index 7db3dc7..d50c5f3 100644 --- a/chrome/test/data/firefox3_pref.js +++ b/chrome/test/data/firefox3_pref.js @@ -88,6 +88,7 @@ user_pref("google.toolbar.opted_into_advanced_features_1", false); user_pref("google.toolbar.rlz", "1B3GGLL_enUS361US372"); user_pref("google.toolbar.safebrowsing.keyupdatetime", 1271867966); user_pref("google.toolbar.search-icon", "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7PT7/3zF6/9Ptu//RbHx/0227/+Tzvb/9vv5/97h0f9JeBz/NHoA/z98Av9AfAD/PHsA/0F6AP8AAAAA/vz7/1+33/8Mp+z/FrHw/xWy8f8bs/T/Hqrx/3zE7v////7/t8qp/zF2A/87gwH/P4ID/z59AP8+egD/Q3kA/97s8v8botj/ELn3/wy58f8PtfL/D7Lw/xuz9P8vq+f/8/n///779v9KhR3/OYYA/0GFAv88hgD/QIAC/z17AP/0+/j/N6bM/wC07/8Cxf7/CsP7/wm+9v8Aqur/SrDb//7+/v///P7/VZEl/zSJAP87jQD/PYYA/0OBBf8+fQH///3//9Dp8/84sM7/CrDf/wC14/8CruL/KqnW/9ns8f/8/v//4OjX/z+GDf85kAD/PIwD/z2JAv8+hQD/PoEA/9C7pv/97uv////+/9Xw+v+w3ej/ls/e/+rz9///////+/z6/22mSf8qjQH/OJMA/zuQAP85iwL/PIgA/zyFAP+OSSL/nV44/7J+Vv/AkG7/7trP//7//f/9//7/6/Lr/2uoRv8tjQH/PJYA/zuTAP87kwD/PY8A/z2KAP89hAD/olkn/6RVHP+eSgj/mEgR//Ho3//+/v7/5Ozh/1GaJv8tlAD/OZcC/zuXAv84lAD/O5IC/z2PAf89iwL/OIkA/6hWFf+cTxD/pm9C/76ihP/8/v//+////8nav/8fdwL/NZsA/zeZAP83mgD/PJQB/zyUAf84jwD/PYsB/z6HAf+fXif/1r6s//79///58u//3r+g/+3i2v/+//3/mbiF/yyCAP87mgP/OpgD/zeWAP85lgD/OpEB/z+TAP9ChwH/7eHb/////v/28ej/tWwo/7tUAP+5XQ7/5M+5/////v+bsZn/IHAd/zeVAP89lgP/O5MA/zaJCf8tZTr/DyuK//3////9////0qmC/7lTAP/KZAT/vVgC/8iQWf/+//3///j//ygpx/8GGcL/ESax/xEgtv8FEMz/AALh/wAB1f///f7///z//758O//GXQL/yGYC/8RaAv/Ojlf/+/////////9QU93/BAD0/wAB//8DAP3/AAHz/wAA5f8DAtr///////v7+/+2bCT/yGMA/89mAP/BWQD/0q+D///+/////P7/Rkbg/wEA+f8AA/z/AQH5/wMA8P8AAev/AADf///7/P////7/uINQ/7lXAP/MYwL/vGIO//Lm3P/8/v//1dT2/woM5/8AAP3/AwH+/wAB/f8AAfb/BADs/wAC4P8AAAAA//z7/+LbzP+mXyD/oUwE/9Gshv/8//3/7/H5/zo/w/8AAdX/AgL6/wAA/f8CAP3/AAH2/wAA7v8AAAAAgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAEAAA=="); +user_pref("lightweightThemes.usedThemes", "[{\"id\":\"2635\",\"name\":\"Mozilla Firefox\",\"headerURL\":\"http://getpersonas-cdn.mozilla.net/static/3/5/2635/firefox_header.jpg?1260925626\",\"footerURL\":\"http://getpersonas-cdn.mozilla.net/static/3/5/2635/firefox_footer.jpg?1260925626\",\"textcolor\":\"#ffffff\",\"accentcolor\":\"#ffffff\",\"iconURL\":\"http://getpersonas-cdn.mozilla.net/static/3/5/2635/preview_small.jpg?1260925626\",\"previewURL\":\"http://getpersonas-cdn.mozilla.net/static/3/5/2635/preview.jpg?1260925626\",\"author\":\"CoreXE\",\"description\":\"Just a Firefox Persona. :D\",\"updateURL\":\"https://www.getpersonas.com/en-US/update_check/2635\",\"version\":\"1260925626\"},{\"id\":\"31209\",\"name\":\"Bubble Bay by David Lanham\",\"accentcolor\":\"#6fb8e6\",\"textcolor\":\"#000000\",\"description\":\"David Lanham\\u0019s day job is working at the Iconfactory creating computer icons like Amora for OSX which was inspired by Chris Cunningham\\u0019s android-esque music video for Björk. But even in his downtime he can\\u0019t stop creating art: when he heads home in the evening he creates pieces of artwork that look as if they have been culled straight out of his own manga movie. David also has a character called Zog who has been made into a vinyl toy by StrangeKiss.\",\"author\":\"Infectious\",\"headerURL\":\"http://getpersonas-cdn.mozilla.net/static/0/9/31209/persona_DavidLanham_header_revised.png?1260925626\",\"footerURL\":\"http://getpersonas-cdn.mozilla.net/static/0/9/31209/persona_DavidLanham_footer_revised.png?1260925626\",\"previewURL\":\"http://getpersonas-cdn.mozilla.net/static/0/9/31209/preview.jpg?1260925626\",\"iconURL\":\"http://getpersonas-cdn.mozilla.net/static/0/9/31209/preview_small.jpg?1260925626\",\"updateURL\":\"https://www.getpersonas.com/en-US/update_check/31209\"},{\"id\":\"30987\",\"name\":\"Endless Possibilities by Etsu\",\"accentcolor\":\"#ffffff\",\"textcolor\":\"#000000\",\"description\":\"Etsu Meusy\\u0019s work has been described as \\u001csunny and clean\\u001d by Giant Robot and \\u001cnostalgia-tinged 70s and 80s pop cultural pastiches\\u001d by Coolhunting. Etsu blends together paint, hand drawn typography and the odd guest appearance from 80s icons like Axl Rose and the Smurfs to create dreamy rainbow colored landscapes. Her artwork has been featured in Nylon magazine and art books by Die Gestalten.\",\"author\":\"Infectious\",\"headerURL\":\"http://getpersonas-cdn.mozilla.net/static/8/7/30987/etsu_v2_header.jpg?1260925626\",\"footerURL\":\"http://getpersonas-cdn.mozilla.net/static/8/7/30987/etsu_v2_footer.jpg?1260925626\",\"previewURL\":\"http://getpersonas-cdn.mozilla.net/static/8/7/30987/preview.jpg?1260925626\",\"iconURL\":\"http://getpersonas-cdn.mozilla.net/static/8/7/30987/preview_small.jpg?1260925626\",\"updateURL\":\"https://www.getpersonas.com/en-US/update_check/30987\"},{\"id\":\"7610\",\"name\":\"Japanese Tattoo\",\"author\":\"enguyen\",\"headerURL\":\"http://getpersonas-cdn.mozilla.net/static/1/0/7610/personajpg.jpg?1260925626\",\"footerURL\":\"http://getpersonas-cdn.mozilla.net/static/1/0/7610/persona2jpg.jpg?1260925626\",\"previewURL\":\"http://getpersonas-cdn.mozilla.net/static/1/0/7610/preview.jpg?1260925626\",\"iconURL\":\"http://getpersonas-cdn.mozilla.net/static/1/0/7610/preview_small.jpg?1260925626\",\"accentcolor\":\"#000000\",\"textcolor\":\"#000000\",\"updateURL\":\"https://www.getpersonas.com/en-US/update_check/7610\",\"version\":\"1260925626\"}]"); user_pref("google.toolbar.searchdomaincheck.done", true); user_pref("google.toolbar.seenInstaller", false); user_pref("google.toolbar.sent", "1"); |