Backed out changeset 313d232c4038 (Bug 163964) for test failures. rs=backout

At least

 comm/mail/components/extensions/test/xpcshell/test_ext_accounts.js
 comm/mail/components/extensions/test/xpcshell/test_ext_folders.js
 comm/mailnews/imap/test/unit/test_imapHighWater.js
This commit is contained in:
Magnus Melin 2021-08-23 16:54:15 +03:00
Родитель a0ce074cc1
Коммит 9ea240eeda
7 изменённых файлов: 22 добавлений и 76 удалений

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

@ -73,10 +73,6 @@ class nsIImapHostSessionList : public nsISupports {
bool discovered) = 0;
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char* serverKey,
bool& result) = 0;
NS_IMETHOD SetDiscoveryForHostInProgress(const char* serverKey,
bool inProgress) = 0;
NS_IMETHOD GetDiscoveryForHostInProgress(const char* serverKey,
bool& result) = 0;
// Trash Folder
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char* serverKey,

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

@ -30,7 +30,6 @@ nsIMAPHostInfo::nsIMAPHostInfo(const char* serverKey,
#else
fHaveWeEverDiscoveredFolders = false; // try this, see what bad happens
#endif
fDiscoveryForHostInProgress = false;
fCanonicalOnlineSubDir = NULL;
fNamespaceList = nsImapNamespaceList::CreatensImapNamespaceList();
fUsingSubscription = true;
@ -297,27 +296,6 @@ NS_IMETHODIMP nsImapHostSessionList::SetHaveWeEverDiscoveredFoldersForHost(
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsImapHostSessionList::GetDiscoveryForHostInProgress(
const char* serverKey, bool& result) {
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo* host = FindHost(serverKey);
if (host)
result = host->fDiscoveryForHostInProgress;
else
result = false;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsImapHostSessionList::SetDiscoveryForHostInProgress(
const char* serverKey, bool inProgress) {
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo* host = FindHost(serverKey);
if (host) host->fDiscoveryForHostInProgress = inProgress;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsImapHostSessionList::SetOnlineTrashFolderExistsForHost(
const char* serverKey, bool exists) {
PR_EnterMonitor(gCachedHostInfoMonitor);

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

@ -32,7 +32,6 @@ class nsIMAPHostInfo {
eIMAPCapabilityFlags fCapabilityFlags;
char* fHierarchyDelimiters; // string of top-level hierarchy delimiters
bool fHaveWeEverDiscoveredFolders;
bool fDiscoveryForHostInProgress;
char* fCanonicalOnlineSubDir;
nsImapNamespaceList *fNamespaceList, *fTempNamespaceList;
bool fNamespacesOverridable;
@ -108,10 +107,6 @@ class nsImapHostSessionList : public nsIImapHostSessionList,
bool discovered) override;
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char* serverKey,
bool& result) override;
NS_IMETHOD SetDiscoveryForHostInProgress(const char* serverKey,
bool inProgress) override;
NS_IMETHOD GetDiscoveryForHostInProgress(const char* serverKey,
bool& result) override;
// Trash Folder
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char* serverKey,

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

@ -884,15 +884,6 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow* aMsgWindow) {
nsCOMPtr<nsIThread> thread(do_GetCurrentThread());
rv =
imapService->DiscoverAllFolders(rootMsgFolder, this, aMsgWindow, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIImapHostSessionList> hostSessionList =
do_GetService(kCImapHostSessionListCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsAutoCString serverKey;
rv = GetKey(serverKey);
if (!serverKey.IsEmpty())
hostSessionList->SetDiscoveryForHostInProgress(serverKey.get(), true);
}
return rv;
}

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

@ -799,34 +799,6 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFolderWithListener(
m_urlListener = aUrlListener;
}
/* Do a discovery in its own url if needed. */
nsCOMPtr<nsIImapHostSessionList> hostSession =
do_GetService(kCImapHostSessionList, &rv);
if (NS_SUCCEEDED(rv) && hostSession) {
bool foundMailboxesAlready = false;
nsCString serverKey;
GetServerKey(serverKey);
hostSession->GetHaveWeEverDiscoveredFoldersForHost(serverKey.get(),
foundMailboxesAlready);
bool discoveryInProgress;
if (!foundMailboxesAlready) {
discoveryInProgress = false;
// See if discovery in progress and not yet finished.
hostSession->GetDiscoveryForHostInProgress(serverKey.get(),
discoveryInProgress);
}
if (!foundMailboxesAlready && !discoveryInProgress) {
nsCOMPtr<nsIMsgFolder> rootFolder;
rv = GetRootFolder(getter_AddRefs(rootFolder));
if (NS_SUCCEEDED(rv) && rootFolder) {
rv = imapService->DiscoverAllFolders(rootFolder, this, aMsgWindow,
nullptr);
if (NS_SUCCEEDED(rv))
hostSession->SetDiscoveryForHostInProgress(serverKey.get(), true);
}
}
}
// Allow IMAP folder auto-compact to occur when online or offline.
if (aMsgWindow) AutoCompact(aMsgWindow);

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

@ -1847,6 +1847,8 @@ bool nsImapProtocol::ProcessCurrentURL() {
if (GetServerStateParser().GetCapabilityFlag() & kHasLanguageCapability)
Language();
if (m_runningUrl) FindMailboxesIfNecessary();
nsImapState imapState = nsIImapUrl::ImapStatusNone;
if (m_runningUrl) m_runningUrl->GetRequiredImapState(&imapState);
@ -1896,11 +1898,6 @@ bool nsImapProtocol::ProcessCurrentURL() {
IMAP, LogLevel::Debug,
("URL failed with code 0x%" PRIx32 " (%s)", static_cast<uint32_t>(rv),
mailnewsurl->GetSpecOrDefault().get()));
// If discovery URL fails, clear the in-progress flag.
if (m_imapAction == nsIImapUrl::nsImapDiscoverAllBoxesUrl) {
m_hostSessionList->SetDiscoveryForHostInProgress(GetImapServerKey(),
false);
}
}
// Inform any nsIUrlListeners that the URL has finished. This will invoke
// nsIUrlListener.onStopRunningUrl().
@ -7152,6 +7149,24 @@ void nsImapProtocol::OnMoveFolderHierarchy(const char* sourceMailbox) {
HandleMemoryFailure();
}
void nsImapProtocol::FindMailboxesIfNecessary() {
// biff should not discover mailboxes
bool foundMailboxesAlready = false;
nsImapAction imapAction;
// need to do this for every connection in order to see folders.
(void)m_runningUrl->GetImapAction(&imapAction);
nsresult rv = m_hostSessionList->GetHaveWeEverDiscoveredFoldersForHost(
GetImapServerKey(), foundMailboxesAlready);
if (NS_SUCCEEDED(rv) && !foundMailboxesAlready &&
(imapAction != nsIImapUrl::nsImapBiff) &&
(imapAction != nsIImapUrl::nsImapVerifylogon) &&
(imapAction != nsIImapUrl::nsImapDiscoverAllBoxesUrl) &&
(imapAction != nsIImapUrl::nsImapUpgradeToSubscription) &&
!GetSubscribingNow())
DiscoverMailboxList();
}
void nsImapProtocol::DiscoverAllAndSubscribedBoxes() {
// used for subscribe pane
// iterate through all namespaces
@ -7467,11 +7482,9 @@ void nsImapProtocol::MailboxDiscoveryFinished() {
} // if trash folder doesn't exist
m_hostSessionList->SetHaveWeEverDiscoveredFoldersForHost(GetImapServerKey(),
true);
// notify front end that folder discovery is complete....
if (m_imapServerSink) m_imapServerSink->DiscoveryDone();
// Clear the discovery in progress flag.
m_hostSessionList->SetDiscoveryForHostInProgress(GetImapServerKey(), false);
}
}

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

@ -609,6 +609,7 @@ class nsImapProtocol : public nsIImapProtocol,
void OnMoveFolderHierarchy(const char* aSourceMailbox);
void DeleteFolderAndMsgs(const char* aSourceMailbox);
void RemoveMsgsAndExpunge();
void FindMailboxesIfNecessary();
void CreateMailbox(const char* mailboxName);
void DeleteMailbox(const char* mailboxName);
void RenameMailbox(const char* existingName, const char* newName);