Bug 426056 - Unresponsive script modules/utils.js after dropping a folder into the Tags folder (for mak77@supereva.it, r=mano, a=beltzner)

This commit is contained in:
dietrich@mozilla.com 2008-04-15 10:17:34 -07:00
parent 0bfbb5c845
commit 24bbd6f227
2 changed files with 16 additions and 11 deletions

View File

@ -860,14 +860,10 @@ PlacesController.prototype = {
removedFolders.push(node);
else if (PlacesUtils.nodeIsTagQuery(node.parent)) {
var queries = asQuery(node.parent).getQueries({});
if (queries.length == 1) {
var folders = queries[0].getFolders({});
if (folders.length == 1) {
var uri = PlacesUtils._uri(node.uri);
var tagItemId = folders[0];
transactions.push(PlacesUIUtils.ptm.untagURI(uri, [tagItemId]));
}
}
var folders = queries[0].getFolders({});
var uri = PlacesUtils._uri(node.uri);
var tagItemId = folders[0];
transactions.push(PlacesUIUtils.ptm.untagURI(uri, [tagItemId]));
continue;
}
@ -1282,7 +1278,13 @@ var PlacesControllerDragHelper = {
xferable.getAnyTransferData(flavor, data, { });
data.value.QueryInterface(Ci.nsISupportsString);
var dragged = PlacesUtils.unwrapNodes(data.value.data, flavor.value)[0];
// Only bookmarks and urls can be dropped into tag containers
if (ip.isTag && dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
/^place:/.test(dragged.uri)))
return false;
// The following loop disallows the dropping of a folder on itself or
// on any of its descendants.
if (dragged.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER ||

View File

@ -592,7 +592,8 @@ var PlacesUtils = {
// note: this._uri() will throw if uriString is not a valid URI
if (this._uri(uriString)) {
nodes.push({ uri: uriString,
title: titleString ? titleString : uriString });
title: titleString ? titleString : uriString ,
type: this.TYPE_X_MOZ_URL });
}
}
break;
@ -602,7 +603,9 @@ var PlacesUtils = {
var uriString = parts[i];
// note: this._uri() will throw if uriString is not a valid URI
if (uriString != "" && this._uri(uriString))
nodes.push({ uri: uriString, title: uriString });
nodes.push({ uri: uriString,
title: uriString,
type: this.TYPE_X_MOZ_URL });
}
break;
default: