Bug 1437651 - Remove unused simulated-places-node references. r?mak draft
authorMark Banner <standard8@mozilla.com>
Mon, 12 Feb 2018 20:33:07 +0000
changeset 754102 3b2ea1eaf1ac2ca39e70b45c7975c1d26e15fa93
parent 753815 3ee38289dac8838fe848f7234d75f3cef5d3dbc7
push id98749
push userbmo:standard8@mozilla.com
push dateMon, 12 Feb 2018 20:33:32 +0000
reviewersmak
bugs1437651
milestone60.0a1
Bug 1437651 - Remove unused simulated-places-node references. r?mak MozReview-Commit-ID: 6JzFXRykF2W
browser/components/places/content/browserPlacesViews.js
browser/components/places/content/controller.js
browser/components/places/content/menu.xml
browser/components/places/tests/browser/browser_views_liveupdate.js
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -903,18 +903,17 @@ PlacesViewBase.prototype = {
       // Menus that have static content at the end, but are initially empty,
       // use a special "builder" attribute to figure out where to start
       // inserting places nodes.
       if (child.getAttribute("builder") == "end") {
         aPopup.insertBefore(aPopup._endMarker, child);
         break;
       }
 
-      if (child._placesNode && !child.hasAttribute("simulated-places-node") &&
-          !firstNonStaticNodeFound) {
+      if (child._placesNode && !firstNonStaticNodeFound) {
         firstNonStaticNodeFound = true;
         aPopup.insertBefore(aPopup._startMarker, child);
       }
     }
     if (!firstNonStaticNodeFound) {
       aPopup.insertBefore(aPopup._startMarker, aPopup._endMarker);
     }
   },
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1405,33 +1405,26 @@ var PlacesControllerDragHelper = {
    * @param   aNode
    *          A nsINavHistoryResultNode node.
    * @param   aView
    *          The view originating the request
    * @param   [optional] aDOMNode
    *          A XUL DOM node.
    * @return True if the node can be moved, false otherwise.
    */
-  canMoveNode(aNode, aView, aDOMNode) {
+  canMoveNode(aNode, aView) {
     // Only bookmark items are movable.
     if (aNode.itemId == -1)
       return false;
 
-    let parentNode = aNode.parent;
-    if (!parentNode) {
-      // Normally parentless places nodes can not be moved,
-      // but simulated bookmarked URI nodes are special.
-      return !!aDOMNode &&
-             aDOMNode.hasAttribute("simulated-places-node") &&
-             PlacesUtils.nodeIsBookmark(aNode);
-    }
-
     // Once tags and bookmarked are divorced, the tag-query check should be
     // removed.
-    return PlacesUtils.nodeIsFolder(parentNode) &&
+    let parentNode = aNode.parent;
+    return parentNode != null &&
+           PlacesUtils.nodeIsFolder(parentNode) &&
            !PlacesUIUtils.isFolderReadOnly(parentNode, aView) &&
            !PlacesUtils.nodeIsTagQuery(parentNode);
   },
 
   /**
    * Handles the drop of one or more items onto a view.
    *
    * @param {Object} insertionPoint The insertion point where the items should
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -345,17 +345,17 @@
         let elt = event.target;
         if (!elt._placesNode)
           return;
 
         let draggedElt = elt._placesNode;
 
         // Force a copy action if parent node is a query or we are dragging a
         // not-removable node.
-        if (!PlacesControllerDragHelper.canMoveNode(draggedElt, this._rootView, elt))
+        if (!PlacesControllerDragHelper.canMoveNode(draggedElt, this._rootView))
           event.dataTransfer.effectAllowed = "copyLink";
 
         // Activate the view and cache the dragged element.
         this._rootView._draggedElt = draggedElt;
         this._rootView.controller.setDataTransfer(event);
         this.setAttribute("dragstart", "true");
         event.stopPropagation();
       ]]></handler>
--- a/browser/components/places/tests/browser/browser_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_views_liveupdate.js
@@ -256,17 +256,17 @@ function getNodeForToolbarItem(aItemId, 
   var placesToolbarItems = document.getElementById("PlacesToolbarItems");
 
   function findNode(aContainer) {
     var children = aContainer.childNodes;
     for (var i = 0, staticNodes = 0; i < children.length; i++) {
       var child = children[i];
 
       // Is this a Places node?
-      if (!child._placesNode || child.hasAttribute("simulated-places-node")) {
+      if (!child._placesNode) {
         staticNodes++;
         continue;
       }
 
       if (child._placesNode.itemId == aItemId) {
         let valid = aValidator ? aValidator(child) : true;
         return [child._placesNode, i - staticNodes, valid];
       }
@@ -299,17 +299,17 @@ function getNodeForMenuItem(aItemId, aVa
   var menu = document.getElementById("bookmarksMenu");
 
   function findNode(aContainer) {
     var children = aContainer.childNodes;
     for (var i = 0, staticNodes = 0; i < children.length; i++) {
       var child = children[i];
 
       // Is this a Places node?
-      if (!child._placesNode || child.hasAttribute("simulated-places-node")) {
+      if (!child._placesNode) {
         staticNodes++;
         continue;
       }
 
       if (child._placesNode.itemId == aItemId) {
         let valid = aValidator ? aValidator(child) : true;
         return [child._placesNode, i - staticNodes, valid];
       }