Bug 1182366 - avoid an invalid bookmark from preventing all bookmarks syncing. r=rnewman

This commit is contained in:
Mark Hammond 2015-07-22 15:10:42 +10:00
parent c13a121531
commit 1e6713632f

View File

@ -269,11 +269,24 @@ BookmarksEngine.prototype = {
id, SMART_BOOKMARKS_ANNO); id, SMART_BOOKMARKS_ANNO);
} catch(ex) {} } catch(ex) {}
if (queryId) if (queryId) {
key = "q" + queryId; key = "q" + queryId;
else } else {
key = "b" + PlacesUtils.bookmarks.getBookmarkURI(id).spec + ":" + let uri;
PlacesUtils.bookmarks.getItemTitle(id); try {
uri = PlacesUtils.bookmarks.getBookmarkURI(id);
} catch (ex) {
// Bug 1182366 - NS_ERROR_MALFORMED_URI here stops bookmarks sync.
this._log.warn("Deleting bookmark with invalid URI. id: " + id);
try {
PlacesUtils.bookmarks.removeItem(id);
} catch (ex) {
this._log.warn("Failed to delete invalid bookmark", ex);
}
continue;
}
key = "b" + uri.spec + ":" + PlacesUtils.bookmarks.getItemTitle(id);
}
break; break;
case PlacesUtils.bookmarks.TYPE_FOLDER: case PlacesUtils.bookmarks.TYPE_FOLDER:
key = "f" + PlacesUtils.bookmarks.getItemTitle(id); key = "f" + PlacesUtils.bookmarks.getItemTitle(id);