Bug 1262639 - Fix NS_ERROR_ILLEGAL_VALUE spam by not run getLivemark without valid node id; r?mak
MozReview-Commit-ID: HgLHJ1vdYVi
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -877,34 +877,35 @@ PlacesTreeView.prototype = {
this.invalidateContainer(aNode);
if (PlacesUtils.nodeIsFolder(aNode) ||
(this._flatList && aNode == this._rootNode)) {
let queryOptions = PlacesUtils.asQuery(this._rootNode).queryOptions;
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);
+ }
}
},
invalidateContainer: function PTV_invalidateContainer(aContainer) {
NS_ASSERT(this._result, "Need to have a result to update");
if (!this._tree)
return;