зеркало из https://github.com/mozilla/pjs.git
Bug 161333 js perf improvement in msgMail3PaneWindow.js, GetFirstSelectedMessage() r=dmose sr=sspitzer
This commit is contained in:
Родитель
a232df99c3
Коммит
51afdd991b
|
@ -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(¤tIndex);
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче