Bug 1437651 - Remove unused simulated-places-node references. r?mak
MozReview-Commit-ID: 6JzFXRykF2W
--- 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];
}