rem: else ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */); 
add:      if (!scrolled) {    scrolled = ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */); if (!scrolled) {    if (sortOrder == nsMsgViewSortOrder.ascending) { switch (sortType) { case nsMsgViewSortType.byDate: case nsMsgViewSortType.byId: case nsMsgViewSortType.byThread: scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */); break; } }   if (!scrolled) EnsureRowInThreadTreeIsVisible(0); } }     
context: function restorePreSearchView(){  var selectedHdr = null;  //save selection  try   {    selectedHdr = gDBView.hdrForFirstSelectedMessage;  }  catch (ex)  {}  //we might have to sort the view coming out of quick search  var sortType = gDBView.sortType;  var sortOrder = gDBView.sortOrder;  var viewFlags = gDBView.viewFlags;  var folder = gDBView.msgFolder;  gDBView.close();  gDBView = null;   if (gPreQuickSearchView)  {    gDBView = gPreQuickSearchView;    if (sortType != gDBView.sortType || sortOrder != gDBView.sortOrder)    {      gDBView.sort(sortType, sortOrder);    }    UpdateSortIndicators(sortType, sortOrder);    gPreQuickSearchView = null;      }  else //create default view type    CreateDBView(folder, nsMsgViewType.eShowAllThreads, viewFlags, sortType, sortOrder);  RerootThreadPane();     //now restore selection  if (selectedHdr)  {    gDBView.selectMsgByKey(selectedHdr.messageKey);    var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);    var selectedIndex = treeView.selection.currentIndex;    if (selectedIndex >= 0)  //scroll      EnsureRowInThreadTreeIsVisible(selectedIndex);    else      ClearMessagePane();  }  else    ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/fb11778fcd55831b6a503398eab1ec22a55015c4/searchBar.js/buggy/mailnews/base/resources/content/searchBar.js