rem: tree.addItemToSelection(messageElement); if(messageElement && (i==0)) tree.ensureElementIsVisible(messageElement); 
add: if(messageElement) { dump("We have a messageElement\n"); tree.addItemToSelection(messageElement); if(i==0) tree.ensureElementIsVisible(messageElement); } 
context: function RestoreThreadPaneSelection(selectionArray){	var tree = GetThreadTree();	var numSelected = selectionArray.length;	msgNavigationService.EnsureDocumentIsLoaded(document);	var messageElement;	for(var i = 0 ; i < numSelected; i++)	{		messageElement = document.getElementById(selectionArray[i]);		if(!messageElement && messageView.showThreads)		{			var treeFolder = GetThreadTreeFolder();			var folderURI = treeFolder.getAttribute('ref');			var folderResource = RDF.GetResource(folderURI);			var folder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);			var messageResource = RDF.GetResource(selectionArray[i]);			var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);			var topLevelMessage = GetTopLevelMessageForMessage(message, folder);			var topLevelResource = topLevelMessage.QueryInterface(Components.interfaces.nsIRDFResource);			var topLevelURI = topLevelResource.Value;			var topElement = document.getElementById(topLevelURI);			if(topElement)			{				msgNavigationService.OpenTreeitemAndDescendants(topElement);			}			messageElement = document.getElementById(selectionArray[i]);		}		tree.addItemToSelection(messageElement);		if(messageElement && (i==0))			tree.ensureElementIsVisible(messageElement);	}}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/0938bbb70031b70863a26099bd6eab59d9a14e34/commandglue.js/buggy/mailnews/base/resources/content/commandglue.js