Bug #244325 --> broadcast a notification to the UI when a message is finished being rendered.

sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2004-06-29 07:08:18 +00:00
Родитель 0deb51580a
Коммит d135597d46
8 изменённых файлов: 68 добавлений и 5 удалений

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

@ -429,6 +429,10 @@ var messageHeaderSink = {
onEndMsgDownload: function(url)
{
},
onEndMsgHeaders: function(url)
{
OnMsgLoaded(url);
},

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

@ -408,6 +408,10 @@ var messageHeaderSink = {
onEndMsgDownload: function(url)
{
},
onEndMsgHeaders: function(url)
{
OnMsgLoaded(url);
},

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

@ -53,6 +53,9 @@
#include "nsIChannel.h"
#include "prinrval.h"
#include "nsITimelineService.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIMimeMiscStatus.h"
#include "nsIMsgWindow.h"
#define MSGFEEDBACK_TIMER_INTERVAL 500
@ -138,6 +141,37 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
NS_TIMELINE_LEAVE("Start Msg Loading is finished");
NS_TIMELINE_MARK_TIMER("Start Msg Loading");
NS_TIMELINE_RESET_TIMER("Start Msg Loading");
// if we are loading message for display purposes, this STATE_STOP notification is
// the only notification we get when layout is actually done rendering the message. We need
// to fire the appropriate msgHdrSink notification in this particular case.
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
if (channel)
{
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl (do_QueryInterface(uri));
if (mailnewsUrl)
{
// get the url type
PRBool messageDisplayUrl;
mailnewsUrl->IsUrlType(nsIMsgMailNewsUrl::eDisplay, &messageDisplayUrl);
if (messageDisplayUrl)
{
// get the header sink
nsCOMPtr<nsIMsgWindow> msgWindow;
mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow)
{
nsCOMPtr<nsIMsgHeaderSink> hdrSink;
msgWindow->GetMsgHeaderSink(getter_AddRefs(hdrSink));
if (hdrSink)
hdrSink->OnEndMsgDownload(mailnewsUrl);
}
}
}
}
StopMeteors();
nsXPIDLString documentDone;
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("documentDone").get(),

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

@ -674,6 +674,11 @@ NS_IMETHODIMP TokenStreamListener::OnEndMsgDownload(nsIMsgMailNewsUrl *url)
return NS_OK;
}
NS_IMETHODIMP TokenStreamListener::OnEndMsgHeaders(nsIMsgMailNewsUrl *url)
{
return NS_OK;
}
NS_IMETHODIMP TokenStreamListener::GetSecurityInfo(nsISupports * *aSecurityInfo)
{

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

@ -7668,7 +7668,13 @@ NS_IMETHODIMP nsImapMockChannel::Close()
}
}
}
m_url = nsnull;
// don't release m_url here. Web progress listeners to the current load
// may not have had a chance to process the stop notification yet and they can
// ask the channel for the url. The circular reference between the mock channel and the
// imap url is broken by nsImapProtocol's call to RemoveChannelFromUrl which is called
// from nsImapProtocol::ReleaseUrlState.
// m_url = nsnull;
mChannelClosed = PR_TRUE;
return NS_OK;

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

@ -1384,6 +1384,10 @@ NS_IMETHODIMP nsImapUrl::IsUrlType(PRUint32 type, PRBool *isType)
(m_imapAction == nsIImapUrl::nsImapOnlineToOfflineMove) ||
(m_imapAction == nsIImapUrl::nsImapOfflineToOnlineMove));
break;
case nsIMsgMailNewsUrl::eDisplay:
*isType = (m_imapAction == nsIImapUrl::nsImapMsgFetch ||
m_imapAction == nsIImapUrl::nsImapMsgFetchPeek);
break;
default:
*isType = PR_FALSE;
};

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

@ -558,7 +558,7 @@ nsMimeHtmlDisplayEmitter::EndBody()
nsresult rv = GetHeaderSink(getter_AddRefs(headerSink));
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl (do_QueryInterface(mURL, &rv));
if (headerSink)
headerSink->OnEndMsgDownload(mailnewsUrl);
headerSink->OnEndMsgHeaders(mailnewsUrl);
return NS_OK;
}

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

@ -59,8 +59,7 @@ interface nsIMimeMiscStatus : nsISupports{
// this is a simple interface which allows someone to listen to all the headers
// that are discovered by mime. We can use this when displaying a message to update
// the msg header in JS.
[scriptable, uuid(756DBE17-B59A-11d3-98A9-001083010E9B)]
[scriptable, uuid(34362984-C7A0-47b2-8BA3-6B67C4AD986F)]
interface nsIMsgHeaderSink : nsISupports {
// You must finish consuming the iterators before returning from processHeaders. aHeaderNames and aHeaderValues will ALWAYS have the same
@ -70,7 +69,14 @@ interface nsIMsgHeaderSink : nsISupports {
void handleAttachment(in string contentType, in string url, in wstring displayName, in string
uri, in boolean aNotDownloaded);
void onEndAllAttachments();
void onEndMsgDownload(in nsIMsgMailNewsUrl url);
// onEndMsgHeaders is called after libmime is done processing a message. At this point it is safe for
// elements like the UI to update junk status, process return receipts, etc.
void onEndMsgHeaders(in nsIMsgMailNewsUrl url);
// onEndMsgDownload is triggered when layout says it is actually done rendering
// the message body in the UI.
void onEndMsgDownload(in nsImsgMailNewsUrl url);
attribute nsISupports securityInfo;
};