Bug 622657 - catch invalid bookmark items and delete them when syncing bookmarks. r=rnewman

This commit is contained in:
Mark Hammond 2015-05-06 11:42:07 +10:00
Родитель 8f91295fc2
Коммит 3ef5dc624b
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -247,7 +247,19 @@ BookmarksEngine.prototype = {
// Figure out with which key to store the mapping.
let key;
let id = this._store.idForGUID(guid);
switch (PlacesUtils.bookmarks.getItemType(id)) {
let itemType;
try {
itemType = PlacesUtils.bookmarks.getItemType(id);
} catch (ex) {
this._log.warn("Deleting invalid bookmark record with id", id);
try {
PlacesUtils.bookmarks.removeItem(id);
} catch (ex) {
this._log.warn("Failed to delete invalid bookmark", ex);
}
continue;
}
switch (itemType) {
case PlacesUtils.bookmarks.TYPE_BOOKMARK:
// Smart bookmarks map to their annotation value.
@ -256,7 +268,7 @@ BookmarksEngine.prototype = {
queryId = PlacesUtils.annotations.getItemAnnotation(
id, SMART_BOOKMARKS_ANNO);
} catch(ex) {}
if (queryId)
key = "q" + queryId;
else