From 3493f234393abe4b34895e24717280c81b142a5e Mon Sep 17 00:00:00 2001 From: Jeff Beckley Date: Fri, 21 Nov 2008 10:21:12 +0000 Subject: [PATCH] Bug 466046 - "MsgOpenNewTabForMessage() broken when specifying a message" [r+sr=bienvenu] --- mail/base/content/mailWindowOverlay.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js index 5e6b8e45ee..f77ec59e58 100644 --- a/mail/base/content/mailWindowOverlay.js +++ b/mail/base/content/mailWindowOverlay.js @@ -1504,17 +1504,23 @@ function MsgOpenNewTabForFolder(uri, key) function MsgOpenNewTabForMessage(messageKey, folderUri) { - if (!messageKey) - messageKey = gDBView.keyForFirstSelectedMessage; + var hdr; - var hdr = gDBView.hdrForFirstSelectedMessage; - if (!folderUri) + // messageKey can be 0 for an actual message (first message in the folder) + if (folderUri) + { + hdr = GetMsgFolderFromUri(folderUri).GetMessageHeader(messageKey); + } + else + { + hdr = gDBView.hdrForFirstSelectedMessage; // Use the header's folder - this will open a msg in a virtual folder view // in its real folder, which is needed if the msg wouldn't be in a new // view with the same terms - e.g., it's read and the view is unread only. // If we cloned the view, we wouldn't have to do this. folderUri = hdr.folder.URI; - + } + // Fix it so we won't try to load the previously loaded message. hdr.folder.lastMessageLoaded = nsMsgKey_None;