Bug 161333 js perf improvement in msgMail3PaneWindow.js, GetFirstSelectedMessage() r=dmose sr=sspitzer

This commit is contained in:
neil%parkwaycc.co.uk 2003-01-20 13:07:06 +00:00
Родитель a232df99c3
Коммит 51afdd991b
2 изменённых файлов: 6 добавлений и 17 удалений

Просмотреть файл

@ -1237,19 +1237,7 @@ function GetSelectedMsgFolders()
function GetFirstSelectedMessage()
{
try {
// Use this instead of gDBView.URIForFirstSelectedMessage, else it
// will return the currentIndex message instead of the highlighted
// message.
//
// note, there may not be any selected messages
//
// XXX todo
// is this inefficient when we've got a lot of message selected?
var selectedMessages = GetSelectedMessages();
if (selectedMessages)
return selectedMessages[0];
else
return null;
return gDBView.URIForFirstSelectedMessage;
}
catch (ex) {
return null;

Просмотреть файл

@ -5344,13 +5344,14 @@ nsMsgDBView::GetKeyForFirstSelectedMessage(nsMsgKey *key)
return NS_OK;
}
PRInt32 currentIndex;
nsresult rv = mTreeSelection->GetCurrentIndex(&currentIndex);
PRInt32 startRange;
PRInt32 endRange;
nsresult rv = mTreeSelection->GetRangeAt(0, &startRange, &endRange);
NS_ENSURE_SUCCESS(rv, rv);
// check that the first index is valid, it may not be if nothing is selected
if (currentIndex >= 0 && currentIndex < GetSize()) {
*key = m_keys.GetAt(currentIndex);
if (startRange >= 0 && startRange < GetSize()) {
*key = m_keys.GetAt(startRange);
}
else {
return NS_ERROR_UNEXPECTED;