зеркало из https://github.com/mozilla/gecko-dev.git
remove the imap channel from the load group when finished running r=mscott
This commit is contained in:
Родитель
fae6e4dc39
Коммит
67dc096258
|
@ -55,4 +55,5 @@ interface nsIImapMockChannel : nsIChannel
|
||||||
void SetLoadGroup(in nsILoadGroup aLoadGroup);
|
void SetLoadGroup(in nsILoadGroup aLoadGroup);
|
||||||
void SetURI(in nsIURI aUrl);
|
void SetURI(in nsIURI aUrl);
|
||||||
void Close();
|
void Close();
|
||||||
|
attribute boolean cancelled;
|
||||||
};
|
};
|
||||||
|
|
|
@ -185,6 +185,7 @@ public:
|
||||||
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel) = 0;
|
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel) = 0;
|
||||||
|
|
||||||
NS_IMETHOD AddChannelToLoadGroup() = 0;
|
NS_IMETHOD AddChannelToLoadGroup() = 0;
|
||||||
|
NS_IMETHOD RemoveChannel(nsresult status) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsIImapUrl_h___ */
|
#endif /* nsIImapUrl_h___ */
|
||||||
|
|
|
@ -458,7 +458,7 @@ nsImapMailFolder::UpdateFolder(nsIMsgWindow *msgWindow)
|
||||||
if (NS_SUCCEEDED(rv) && pEventQService)
|
if (NS_SUCCEEDED(rv) && pEventQService)
|
||||||
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),
|
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),
|
||||||
getter_AddRefs(eventQ));
|
getter_AddRefs(eventQ));
|
||||||
rv = imapService->SelectFolder(eventQ, this, this, nsnull, nsnull);
|
rv = imapService->SelectFolder(eventQ, this, this, msgWindow, nsnull);
|
||||||
m_urlRunning = PR_TRUE;
|
m_urlRunning = PR_TRUE;
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -1060,6 +1060,11 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
||||||
WaitForFEEventCompletion();
|
WaitForFEEventCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// probably the wrong place to remove the channel - we need
|
||||||
|
// a place where we know we're finished with the url.
|
||||||
|
if (m_runningUrl)
|
||||||
|
m_runningUrl->RemoveChannel(NS_OK);
|
||||||
|
|
||||||
// release this by hand so that we can load the next queued url without thinking
|
// release this by hand so that we can load the next queued url without thinking
|
||||||
// this connection is busy running a url.
|
// this connection is busy running a url.
|
||||||
m_runningUrl = null_nsCOMPtr();
|
m_runningUrl = null_nsCOMPtr();
|
||||||
|
@ -3341,11 +3346,16 @@ PRMonitor *nsImapProtocol::GetDataMemberMonitor()
|
||||||
// in 4.5 - we need to think about this some. Some of it may just go away in the new world order
|
// in 4.5 - we need to think about this some. Some of it may just go away in the new world order
|
||||||
PRBool nsImapProtocol::DeathSignalReceived()
|
PRBool nsImapProtocol::DeathSignalReceived()
|
||||||
{
|
{
|
||||||
PRBool returnValue;
|
PRBool returnValue = PR_FALSE;
|
||||||
|
if (m_mockChannel)
|
||||||
|
m_mockChannel->GetCancelled(&returnValue);
|
||||||
|
|
||||||
|
if (!returnValue) // check the other way of cancelling.
|
||||||
|
{
|
||||||
PR_EnterMonitor(m_threadDeathMonitor);
|
PR_EnterMonitor(m_threadDeathMonitor);
|
||||||
returnValue = m_threadShouldDie;
|
returnValue = m_threadShouldDie;
|
||||||
PR_ExitMonitor(m_threadDeathMonitor);
|
PR_ExitMonitor(m_threadDeathMonitor);
|
||||||
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6149,6 +6159,7 @@ nsImapMockChannel::nsImapMockChannel()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
m_channelContext = nsnull;
|
m_channelContext = nsnull;
|
||||||
|
m_cancelled = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsImapMockChannel::~nsImapMockChannel()
|
nsImapMockChannel::~nsImapMockChannel()
|
||||||
|
@ -6323,13 +6334,8 @@ NS_IMETHODIMP nsImapMockChannel::IsPending(PRBool *result)
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapMockChannel::Cancel()
|
NS_IMETHODIMP nsImapMockChannel::Cancel()
|
||||||
{
|
{
|
||||||
if (m_channelContext)
|
m_cancelled = PR_TRUE;
|
||||||
{
|
return NS_OK;
|
||||||
nsCOMPtr<nsIImapProtocol> protocol = do_QueryInterface(m_channelContext);
|
|
||||||
if (protocol)
|
|
||||||
protocol->TellThreadToDie(PR_TRUE);
|
|
||||||
}
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapMockChannel::Suspend()
|
NS_IMETHODIMP nsImapMockChannel::Suspend()
|
||||||
|
@ -6341,3 +6347,17 @@ NS_IMETHODIMP nsImapMockChannel::Resume()
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsImapMockChannel::GetCancelled(PRBool *aResult)
|
||||||
|
{
|
||||||
|
if (!aResult)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
*aResult = m_cancelled;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsImapMockChannel::SetCancelled(PRBool cancelled)
|
||||||
|
{
|
||||||
|
m_cancelled = cancelled;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -559,6 +559,7 @@ protected:
|
||||||
// non owning ref of the context in order to fix a circular ref count
|
// non owning ref of the context in order to fix a circular ref count
|
||||||
// because the context is already the uri...
|
// because the context is already the uri...
|
||||||
nsISupports * m_channelContext;
|
nsISupports * m_channelContext;
|
||||||
|
PRBool m_cancelled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsImapProtocol_h___
|
#endif // nsImapProtocol_h___
|
||||||
|
|
|
@ -81,6 +81,7 @@ nsImapUrl::~nsImapUrl()
|
||||||
PR_FREEIF(m_listOfMessageIds);
|
PR_FREEIF(m_listOfMessageIds);
|
||||||
PR_FREEIF(m_destinationCanonicalFolderPathSubString);
|
PR_FREEIF(m_destinationCanonicalFolderPathSubString);
|
||||||
PR_FREEIF(m_sourceCanonicalFolderPathSubString);
|
PR_FREEIF(m_sourceCanonicalFolderPathSubString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
|
NS_IMPL_ADDREF_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
|
||||||
|
@ -946,6 +947,20 @@ NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsImapUrl::RemoveChannel(nsresult status)
|
||||||
|
{
|
||||||
|
nsCOMPtr <nsILoadGroup> aLoadGroup;
|
||||||
|
if (m_mockChannel)
|
||||||
|
{
|
||||||
|
GetLoadGroup(getter_AddRefs(aLoadGroup));
|
||||||
|
if (aLoadGroup)
|
||||||
|
{
|
||||||
|
aLoadGroup->RemoveChannel(m_mockChannel, nsnull, status, nsnull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapUrl::GetAllowContentChange(PRBool *result)
|
NS_IMETHODIMP nsImapUrl::GetAllowContentChange(PRBool *result)
|
||||||
{
|
{
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
@ -95,6 +95,7 @@ public:
|
||||||
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel);
|
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel);
|
||||||
|
|
||||||
NS_IMETHOD AddChannelToLoadGroup();
|
NS_IMETHOD AddChannelToLoadGroup();
|
||||||
|
NS_IMETHOD RemoveChannel(nsresult status);
|
||||||
// nsIMsgMessageUrl
|
// nsIMsgMessageUrl
|
||||||
NS_DECL_NSIMSGMESSAGEURL
|
NS_DECL_NSIMSGMESSAGEURL
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче