Bug 1262639 - Fix NS_ERROR_ILLEGAL_VALUE spam by not run getLivemark without valid node id; r=mak
authorgasolin <gasolin@gmail.com>
Wed, 20 Apr 2016 17:38:54 +0800
changeset 317810 c20f12a0e9add62a17ccf8a671dd96d4f9e6e8bf
parent 317809 fd6f37cd30b29fcfcd173ec9259da1af3e60c30c
child 317811 75848971e880c85802bfe3f19c39fedf6d9c773a
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1262639
milestone48.0a1
Bug 1262639 - Fix NS_ERROR_ILLEGAL_VALUE spam by not run getLivemark without valid node id; r=mak MozReview-Commit-ID: HgLHJ1vdYVi
browser/components/places/content/treeView.js
--- 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;