Bug 1262639 - Fix NS_ERROR_ILLEGAL_VALUE spam by not run getLivemark without valid node id; r=mak

MozReview-Commit-ID: HgLHJ1vdYVi

--HG--
extra : rebase_source : 8200cd1c3f1c8c2db9f6193b3b5c28f23a3c272e
This commit is contained in:
gasolin 2016-04-20 17:38:54 +08:00
Родитель 419dd51f60
Коммит aa79932ce4
1 изменённых файлов: 19 добавлений и 18 удалений

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

@ -882,24 +882,25 @@ PlacesTreeView.prototype = {
if (queryOptions.excludeItems) {
return;
}
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
.then(aLivemark => {
let shouldInvalidate =
!this._controller.hasCachedLivemarkInfo(aNode);
this._controller.cacheLivemarkInfo(aNode, aLivemark);
if (aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_OPENED) {
aLivemark.registerForUpdates(aNode, this);
// Prioritize the current livemark.
aLivemark.reload();
PlacesUtils.livemarks.reloadLivemarks();
if (shouldInvalidate)
this.invalidateContainer(aNode);
}
else {
aLivemark.unregisterForUpdates(aNode);
}
}, () => undefined);
if (aNode.itemId != -1) { // run when there's a valid node id
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
.then(aLivemark => {
let shouldInvalidate =
!this._controller.hasCachedLivemarkInfo(aNode);
this._controller.cacheLivemarkInfo(aNode, aLivemark);
if (aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_OPENED) {
aLivemark.registerForUpdates(aNode, this);
// Prioritize the current livemark.
aLivemark.reload();
PlacesUtils.livemarks.reloadLivemarks();
if (shouldInvalidate)
this.invalidateContainer(aNode);
}
else {
aLivemark.unregisterForUpdates(aNode);
}
}, () => undefined);
}
}
},