rem: if (bookmarksChangedFlag == true) 
add: if (dirty == true) 
context: function DropOnTree ( event ){	var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();	if (RDF)	RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);	if (!RDF)	return(false);	var RDFC = Components.classes["component://netscape/rdf/container"].getService();	RDFC = RDFC.QueryInterface(Components.interfaces.nsIRDFContainer);	if (!RDFC)	return(false);	var Bookmarks = RDF.GetDataSource("rdf:bookmarks");	if (!Bookmarks)	return(false);	var treeRoot = document.getElementById("bookmarksTree");	if (!treeRoot)	return(false);	var treeDatabase = treeRoot.database;	if (!treeDatabase)	return(false);	// target is the <treecell>, and "id" is on the <treeitem> two levels above	var treeItem = event.target.parentNode.parentNode;	if (!treeItem)	return(false);	var targetID = getAbsoluteID(treeRoot, treeItem);	if (!targetID)	return(false);	var targetNode = RDF.GetResource(targetID, true);	if (!targetNode)	return(false);	// get drop hint attributes	var dropBefore = treeItem.getAttribute("dd-droplocation");	var dropOn = treeItem.getAttribute("dd-dropon");	// calculate drop action	var dropAction;	if (dropBefore == "true")	dropAction = "before";	else if (dropOn == "true")	dropAction = "on";	else				dropAction = "after";	// calculate parent container node	var containerItem = treeItem;	if (dropAction != "on")		containerItem = treeItem.parentNode.parentNode;	var containerID = getAbsoluteID(treeRoot, containerItem);	if (!containerID)	return(false);	var containerNode = RDF.GetResource(containerID);	if (!containerNode)	return(false);	var dragService = Components.classes["component://netscape/widget/dragservice"].getService();	if ( dragService ) dragService = dragService.QueryInterface(Components.interfaces.nsIDragService);	if ( !dragService )	return(false);		var dragSession = dragService.getCurrentSession();	if ( !dragSession )	return(false);	var trans = Components.classes["component://netscape/widget/transferable"].createInstance();	if ( trans ) trans = trans.QueryInterface(Components.interfaces.nsITransferable);	if ( !trans )		return(false);	trans.addDataFlavor("text/plain");	var bookmarksChangedFlag = false;	for ( var i = 0; i < dragSession.numDropItems; ++i )	{		dragSession.getData ( trans, i );		var dataObj = new Object();		var bestFlavor = new Object();		var len = new Object();		trans.getAnyTransferData ( bestFlavor, dataObj, len );		if ( dataObj )	dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);		if ( !dataObj )	continue;		// pull the URL out of the data object		var sourceID = dataObj.data.substring(0, len.value);		if (!sourceID)	continue;		dump("    Node #" + i + ": drop '" + sourceID + "' " + dropAction + " '" + targetID + "'\n");		var sourceNode = RDF.GetResource(sourceID, true);		if (!sourceNode)	continue;				// Prevent dropping of a node before, after, or on itself		if (sourceNode == targetNode)	continue;		RDFC.Init(Bookmarks, containerNode);		if ((dropAction == "before") || (dropAction == "after"))		{			// drop before or after			var nodeIndex;			nodeIndex = RDFC.IndexOf(sourceNode);			if (nodeIndex >= 1)			{				// moving a node around inside of the container				// so remove, then re-add the node				RDFC.RemoveElementAt(nodeIndex, true, sourceNode);			}						nodeIndex = RDFC.IndexOf(targetNode);			if (nodeIndex < 1)	return(false);			if (dropAction == "after")	++nodeIndex;			RDFC.InsertElementAt(sourceNode, nodeIndex, true);			bookmarksChangedFlag = true;		}		else		{			// drop on			RDFC.AppendElement(sourceNode);			bookmarksChangedFlag = true;		}	}	if (bookmarksChangedFlag == true)	{		var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);		if (remote)		{			remote.Flush();			dump("Wrote out bookmark changes.\n");		}	}	return(false);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/626e6a519c2792e00df13ded020ee0d1d0076dbb/bookmarks.js/buggy/xpfe/components/bookmarks/resources/bookmarks.js