rem: var resultsTree = document.getElementById("Tree"); if( !resultsTree)	return(false); var ds = resultsTree.database; if (!ds)		return(false); 
add: var ds = document.getElementById("Tree").database; if (!ds) return; 
context: function saveSearch(){	var resultsTree = document.getElementById("Tree");	if( !resultsTree)	return(false);	var ds = resultsTree.database;	if (!ds)		return(false);	var	lastSearchURI="";	var	lastSearchText="";  var rdf = nsJSComponentManager.getService(RDFSERVICE_CONTRACTID, "nsIRDFService");	if (rdf)	{		// look for last search URI		var source = rdf.GetResource( "NC:LastSearchRoot", true);		var childProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#ref", true);		var target = ds.GetTarget(source, childProperty, true);		if (target)	target = target.QueryInterface(nsIRDFLiteral);		if (target)	target = target.Value;		if (target) lastSearchURI = target;		// look for last search text		childProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);		target = ds.GetTarget(source, childProperty, true);		if (target)	target = target.QueryInterface(nsIRDFLiteral);		if (target)	target = target.Value;		if (target)		{			// convert pluses (+) back to spaces			target = target.replace(/+/i, " ");			lastSearchText = unescape(target);			debug("Bookmark search Name: '" + lastSearchText + "'\n");		}	}	if (!lastSearchURI)	return(false);    // 	rjc says: if lastSearchText is empty/null, that's still OK, synthesize the text	if ((lastSearchText == null) || (lastSearchText == ""))	{		lastSearchText = lastSearchURI;		var siteOffset = lastSearchText.indexOf("://");		if (siteOffset > 0)		{			siteOffset += 3;			var endOffset = lastSearchText.indexOf("/", siteOffset);			if (endOffset > 0)			{				lastSearchText = lastSearchText.substr(0, endOffset+1);			}		}	}    var bmks = Components.classes[BMARKS_CONTRACTID].getService(nsIBookmarksService);	var textNode = document.getElementById("sidebar-search-text");	if( !textNode )		return(false);	var searchTitle = "Search: '" + lastSearchText + "'";	// using " + gSites;	if (bmks)	bmks.AddBookmark(lastSearchURI, searchTitle, bmks.BOOKMARK_SEARCH_TYPE, null);	return(true);}
meta: 5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5459/92255768432d56941bc6db8dcc4e84be97378a11/search-panel.js/clean/suite/common/search/search-panel.js