Bug 369222 - Javascript error when opening the context menu for the empty area (i.e. root node) in the places toolbar. r=sspitzer.
git-svn-id: svn://10.0.0.236/trunk@219474 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1abd4f2810
commit
36cdb865b5
@ -257,13 +257,17 @@ PlacesController.prototype = {
|
||||
this._canInsert() &&
|
||||
this._view.peerDropTypes.indexOf(TYPE_X_MOZ_PLACE_SEPARATOR) != -1;
|
||||
case "placesCmd_show:info":
|
||||
var selectedNode = this._view.selectedNode;
|
||||
if (this._view.hasSingleSelection &&
|
||||
!PlacesUtils.nodeIsLivemarkContainer(selectedNode.parent) &&
|
||||
!this._selectionOverlapsSystemArea()) {
|
||||
if (PlacesUtils.nodeIsBookmark(selectedNode) ||
|
||||
PlacesUtils.nodeIsFolder(selectedNode))
|
||||
if (this._view.hasSingleSelection) {
|
||||
var selectedNode = this._view.selectedNode;
|
||||
if (PlacesUtils.nodeIsBookmark(selectedNode))
|
||||
return true;
|
||||
if (PlacesUtils.nodeIsFolder(selectedNode)) {
|
||||
if (!this._selectionOverlapsSystemArea()) {
|
||||
var parent = selectedNode.parent;
|
||||
if (!parent || !PlacesUtils.nodeIsLivemarkContainer(parent))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@ -204,6 +204,7 @@ var PlacesUtils = {
|
||||
*/
|
||||
nodeIsSeparator: function PU_nodeIsSeparator(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
return (aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR);
|
||||
},
|
||||
|
||||
@ -215,6 +216,7 @@ var PlacesUtils = {
|
||||
*/
|
||||
nodeIsURI: function PU_nodeIsURI(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
const NHRN = Ci.nsINavHistoryResultNode;
|
||||
return aNode.type == NHRN.RESULT_TYPE_URI ||
|
||||
aNode.type == NHRN.RESULT_TYPE_VISIT ||
|
||||
@ -229,6 +231,7 @@ var PlacesUtils = {
|
||||
*/
|
||||
nodeIsQuery: function PU_nodeIsQuery(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
return aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY;
|
||||
},
|
||||
|
||||
@ -241,6 +244,7 @@ var PlacesUtils = {
|
||||
*/
|
||||
nodeIsReadOnly: function PU_nodeIsReadOnly(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
if (this.nodeIsFolder(aNode))
|
||||
return this.bookmarks.getFolderReadonly(asFolder(aNode).folderId);
|
||||
if (this.nodeIsQuery(aNode))
|
||||
@ -255,6 +259,8 @@ var PlacesUtils = {
|
||||
* @returns true if the node is a host item, false otherwise
|
||||
*/
|
||||
nodeIsHost: function PU_nodeIsHost(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
return aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_HOST;
|
||||
},
|
||||
|
||||
@ -265,6 +271,8 @@ var PlacesUtils = {
|
||||
* @returns true if the node is a container item, false otherwise
|
||||
*/
|
||||
nodeIsContainer: function PU_nodeIsContainer(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
const NHRN = Ci.nsINavHistoryResultNode;
|
||||
return aNode.type == NHRN.RESULT_TYPE_HOST ||
|
||||
aNode.type == NHRN.RESULT_TYPE_QUERY ||
|
||||
@ -287,6 +295,8 @@ var PlacesUtils = {
|
||||
* @returns true if the node is a container item, false otherwise
|
||||
*/
|
||||
nodeIsRemoteContainer: function PU_nodeIsRemoteContainer(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
const NHRN = Ci.nsINavHistoryResultNode;
|
||||
if (aNode.type == NHRN.RESULT_TYPE_REMOTE_CONTAINER)
|
||||
return true;
|
||||
@ -315,6 +325,8 @@ var PlacesUtils = {
|
||||
* @returns true if the node is a readonly folder.
|
||||
*/
|
||||
folderIsReadonly: function(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
return this.nodeIsFolder(aNode) &&
|
||||
this.bookmarks.getFolderReadonly(asFolder(aNode).folderId);
|
||||
},
|
||||
@ -327,6 +339,8 @@ var PlacesUtils = {
|
||||
* node was not found or the node specified has no parent.
|
||||
*/
|
||||
getIndexOfNode: function PU_getIndexOfNode(aNode) {
|
||||
NS_ASSERT(aNode, "null node");
|
||||
|
||||
var parent = aNode.parent;
|
||||
if (!parent || !PlacesUtils.nodeIsContainer(parent))
|
||||
return -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user