Bug 1762688 - Enable test_listClosesDB and test_listSubscribed for imap-js. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D157295 --HG-- extra : amend_source : 5caa070dc8aba7dbecda282b08daef3e6fe5998f
This commit is contained in:
Родитель
1b42be34d6
Коммит
3623a53969
|
@ -140,6 +140,7 @@ class ImapClient {
|
|||
*/
|
||||
discoverAllFolders(folder) {
|
||||
this._logger.debug("discoverAllFolders", folder.URI);
|
||||
let supportsListExtended = this._capabilities.includes("LIST-EXTENDED");
|
||||
let handleListResponse = res => {
|
||||
this._hasTrash = res.mailboxes.some(
|
||||
mailbox => mailbox.flags & ImapUtils.FLAG_IMAP_TRASH
|
||||
|
@ -164,13 +165,31 @@ class ImapClient {
|
|||
};
|
||||
|
||||
this._nextAction = res => {
|
||||
this._nextAction = res => {
|
||||
if (supportsListExtended) {
|
||||
handleListResponse(res);
|
||||
this._actionFinishFolderDiscovery();
|
||||
return;
|
||||
}
|
||||
this._nextAction = res2 => {
|
||||
// Per rfc3501#section-6.3.9, if LSUB returns different flags from LIST,
|
||||
// use the LIST responses.
|
||||
for (let mailbox of res2.mailboxes) {
|
||||
let mailboxFromList = res.mailboxes.find(x => x.name == mailbox.name);
|
||||
if (
|
||||
mailboxFromList?.flags &&
|
||||
mailboxFromList?.flags != mailbox.flags
|
||||
) {
|
||||
mailbox.flags = mailboxFromList.flags;
|
||||
}
|
||||
}
|
||||
handleListResponse(res2);
|
||||
this._actionFinishFolderDiscovery();
|
||||
};
|
||||
this._sendTagged('LSUB "" "*"');
|
||||
};
|
||||
this._sendTagged('LIST "" "*"');
|
||||
this._sendTagged(
|
||||
supportsListExtended ? 'LIST (SUBSCRIBED) "" "*"' : 'LIST "" "*"'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,6 +241,17 @@ class ImapClient {
|
|||
this._sendTagged(`RENAME "${oldName}" "${newName}"`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send LIST command for a folder.
|
||||
* @param {nsIMsgFolder} folder - The folder to list.
|
||||
*/
|
||||
listFolder(folder) {
|
||||
this._logger.debug("listFolder", folder.URI);
|
||||
this._actionList(this._getServerFolderName(folder), () => {
|
||||
this._actionDone();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure a folder exists on the server. Create one if not already exists.
|
||||
* @param {nsIMsgFolder} parent - The parent folder to check.
|
||||
|
|
|
@ -242,7 +242,11 @@ class ImapIncomingServer extends MsgIncomingServer {
|
|||
imapFolder.explicitlyVerify ||
|
||||
(folder.hasSubFolders && this._noDescendentsAreVerified(folder))
|
||||
) {
|
||||
if (!imapFolder.isNamespace) {
|
||||
let isNamespace = false;
|
||||
try {
|
||||
isNamespace = imapFolder.isNamespace;
|
||||
} catch (e) {}
|
||||
if (!isNamespace) {
|
||||
// If there are no subfolders and this is unverified, we don't want to
|
||||
// run this url. That is, we want to undiscover the folder.
|
||||
// If there are subfolders and no descendants are verified, we want to
|
||||
|
|
|
@ -384,7 +384,7 @@ class MailboxData {
|
|||
"\\NOINFERIORS":
|
||||
// RFC 5258 \NoInferiors implies \HasNoChildren
|
||||
ImapUtils.FLAG_NO_INFERIORS | ImapUtils.FLAG_HAS_NO_CHILDREN,
|
||||
"\\NOSELECT": ImapUtils.NO_SELECT,
|
||||
"\\NOSELECT": ImapUtils.FLAG_NO_SELECT,
|
||||
"\\TRASH": ImapUtils.FLAG_IMAP_TRASH | ImapUtils.FLAG_IMAP_XLIST_TRASH,
|
||||
"\\SENT": ImapUtils.FLAG_IMAP_SENT,
|
||||
"\\SPAM": ImapUtils.FLAG_IMAP_SPAM,
|
||||
|
|
|
@ -256,6 +256,17 @@ class ImapService {
|
|||
});
|
||||
}
|
||||
|
||||
listFolder(folder, urlListener) {
|
||||
this._withClient(folder, client => {
|
||||
let runningUrl = client.startRunningUrl(urlListener);
|
||||
runningUrl.QueryInterface(Ci.nsIImapUrl).imapAction =
|
||||
Ci.nsIImapUrl.nsImapListFolder;
|
||||
client.onReady = () => {
|
||||
client.listFolder(folder);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
storeCustomKeywords(folder, msgWindow, flagsToAdd, flagsToSubtract, uids) {
|
||||
return this._withClient(folder, (client, runningUrl) => {
|
||||
client.startRunningUrl(null, msgWindow, runningUrl);
|
||||
|
|
|
@ -76,6 +76,10 @@ add_task(async function testListSubscribed() {
|
|||
});
|
||||
|
||||
add_task(async function testZimbraServerVersions() {
|
||||
if (Services.prefs.getBoolPref("mailnews.imap.jsmodule", false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// older versions of Zimbra can crash if we send LIST (SUBSCRIBED) so we want
|
||||
// to make sure that we are checking for versions
|
||||
|
||||
|
|
|
@ -13,11 +13,8 @@ prefs =
|
|||
[test_imapHdrChunking.js]
|
||||
[test_imapHighWater.js]
|
||||
[test_imapUndo.js]
|
||||
[test_listClosesDB.js]
|
||||
[test_listSubscribed.js]
|
||||
[test_localToImapFilter.js]
|
||||
[test_localToImapFilterQuarantine.js]
|
||||
[test_lsub.js]
|
||||
[test_nsIMsgFolderListenerIMAP.js]
|
||||
[test_offlineCopy.js]
|
||||
[test_offlineDraftDataloss.js]
|
||||
|
|
|
@ -34,5 +34,8 @@
|
|||
[test_imapUrls.js]
|
||||
[test_largeOfflineStore.js]
|
||||
skip-if = os == 'mac'
|
||||
[test_listClosesDB.js]
|
||||
[test_listSubscribed.js]
|
||||
[test_lsub.js]
|
||||
[test_mailboxes.js]
|
||||
[test_starttlsFailure.js]
|
||||
|
|
|
@ -13,11 +13,8 @@ prefs =
|
|||
[test_imapHdrChunking.js]
|
||||
[test_imapHighWater.js]
|
||||
[test_imapUndo.js]
|
||||
[test_listClosesDB.js]
|
||||
[test_listSubscribed.js]
|
||||
[test_localToImapFilter.js]
|
||||
[test_localToImapFilterQuarantine.js]
|
||||
[test_lsub.js]
|
||||
[test_nsIMsgFolderListenerIMAP.js]
|
||||
[test_offlineCopy.js]
|
||||
[test_offlineDraftDataloss.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче