rem: debug("Appended node onto end of container\n"); 
add: debug("Appended node onto end of container"); 
context: function doPaste(){	var treeNode = document.getElementById("bookmarksTree");	if (!treeNode)    return(false);	var select_list = treeNode.selectedItems;	if (!select_list)	return(false);	if (select_list.length != 1)    return(false);		var pasteNodeID = select_list[0].getAttribute("id");	debug("Paste onto " + pasteNodeID + "\n");	var isContainerFlag = select_list[0].getAttribute("container") == "true" ? true:false;	debug("Container status: " + ((isContainerFlag) ? "true" : "false") + "\n\n");	var clip = Components.classes["component://netscape/widget/clipboard"].createInstance();	if ( clip ) clip = clip.QueryInterface(Components.interfaces.nsIClipboard);	if (!clip)	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/unicode");	clip.getData(trans);	var data = new Object();	var dataLen = new Object();	trans.getTransferData("text/unicode", data, dataLen);	if (data)	data = data.value.QueryInterface(Components.interfaces.nsISupportsWString);	var url=null;	if (data)	url = data.data.substring(0, dataLen.value / 2);	// double byte data	if (!url)	return(false);	var strings = url.split(";");	if (!strings)	return(false);	var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();	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 nameRes = RDF.GetResource("http://home.netscape.com/NC-rdf#Name");	if (!nameRes)	return(false);	pasteNodeRes = RDF.GetResource(pasteNodeID);	if (!pasteNodeRes)	return(false);	var pasteContainerRes = null;	var pasteNodeIndex = -1;	if (isContainerFlag == true)	{		pasteContainerRes = pasteNodeRes;	}	else	{		var parID = select_list[0].parentNode.parentNode.getAttribute("ref");		if (!parID)	parID = select_list[0].parentNode.parentNode.getAttribute("id");		if (!parID)	return(false);		pasteContainerRes = RDF.GetResource(parID);		if (!pasteContainerRes)	return(false);	}	RDFC.Init(Bookmarks, pasteContainerRes);	debug("Inited RDFC\n");	if (isContainerFlag == false)	{		pasteNodeIndex = RDFC.IndexOf(pasteNodeRes);		if (pasteNodeIndex < 0)	return(false);			// how did that happen?	}	debug("Loop over strings\n");	var dirty = false;	for (var x=0; x<strings.length; x=x+2)	{		var theID = strings[x];		var theName = strings[x+1];		if ((theID.indexOf("ID:{") == 0) && (theName.indexOf("NAME:{") == 0))		{			theID = theID.substr(4, theID.length-5);			theName = theName.substr(6, theName.length-7);			debug("Paste  ID: " + theID + "    NAME: " + theName + "\n");			var IDRes = RDF.GetResource(theID);			if (!IDRes)	continue;			if (RDFC.IndexOf(IDRes) > 0)			{				dump("Unable to add ID:'" + theID + "' as its already in this folder.\n");				continue;			}			if (theName != "")			{				var NameLiteral = RDF.GetLiteral(theName);				if (NameLiteral)				{					Bookmarks.Assert(IDRes, nameRes, NameLiteral, true);					dirty = true;				}			}			if (isContainerFlag == true)			{				RDFC.AppendElement(IDRes);				debug("Appended node onto end of container\n");			}			else			{				RDFC.InsertElementAt(IDRes, pasteNodeIndex++, true);				debug("Pasted at index # " + pasteNodeIndex + "\n");			}			dirty = true;		}	}	if (dirty == true)	{		var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);		if (remote)		{			remote.Flush();			debug("Wrote out bookmark changes.\n");		}	}	return(true);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/d1036add70168e282f812b4a9ed6408593aada54/bookmarks.js/buggy/xpfe/components/bookmarks/resources/bookmarks.js