Bug 1762688 - Fix for gloda tests to pass in imap-js. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D166990 --HG-- extra : amend_source : ae64e6578f60b1f0d53782ec4d5b78b65f9e6548
This commit is contained in:
Родитель
88865380bc
Коммит
a734320544
|
@ -153,7 +153,10 @@ const startupPhases = {
|
|||
"resource:///modules/ImapIncomingServer.jsm",
|
||||
"resource:///modules/ImapMessageMessageService.jsm",
|
||||
"resource:///modules/ImapMessageService.jsm",
|
||||
"resource:///modules/ImapProtocolHandler.jsm",
|
||||
// Skipped due to the way ImapModuleLoader and registerProtocolHandler
|
||||
// works, uncomment once ImapModuleLoader is removed and imap-js becomes
|
||||
// the only IMAP implemention.
|
||||
// "resource:///modules/ImapProtocolHandler.jsm",
|
||||
"resource:///modules/ImapService.jsm",
|
||||
"resource:///modules/NntpIncomingServer.jsm",
|
||||
"resource:///modules/NntpMessageService.jsm",
|
||||
|
|
|
@ -805,6 +805,10 @@ class MsgIncomingServer {
|
|||
// If hostname changed and the pretty name has the old hostname after @,
|
||||
// update to the new hostname.
|
||||
this.prettyName = this.prettyName.slice(0, atIndex + 1) + newValue;
|
||||
} else {
|
||||
// Set the `name` pref anyway, to make tests happy.
|
||||
// eslint-disable-next-line no-self-assign
|
||||
this.prettyName = this.prettyName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ function verify_attributes_fundamental(smsg, gmsg) {
|
|||
|
||||
try {
|
||||
// Will throw if the URL is invalid.
|
||||
channel.open();
|
||||
channel.asyncOpen(new PromiseTestUtils.PromiseStreamListener());
|
||||
} catch (e) {
|
||||
do_throw(new Error("Invalid attachment URL"));
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ async function test_moved_message_attributes() {
|
|||
contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER,
|
||||
});
|
||||
try {
|
||||
channel.open();
|
||||
channel.asyncOpen(new PromiseTestUtils.PromiseStreamListener());
|
||||
} catch (e) {
|
||||
new Error("Invalid attachment URL");
|
||||
}
|
||||
|
|
|
@ -439,6 +439,7 @@ class ImapClient {
|
|||
* @returns {string}
|
||||
*/
|
||||
_getServerSubFolderName(parent, folderName) {
|
||||
folderName = this._charsetManager.unicodeToMutf7(folderName);
|
||||
let mailboxName = this._getServerFolderName(parent);
|
||||
if (mailboxName) {
|
||||
let delimiter = parent.QueryInterface(Ci.nsIMsgImapMailFolder)
|
||||
|
@ -1520,9 +1521,6 @@ class ImapClient {
|
|||
* @param {ImapResponse} res - Response received from the server.
|
||||
*/
|
||||
_actionUidFetchBodyResponse(res) {
|
||||
this.folder
|
||||
.QueryInterface(Ci.nsIImapMailFolderSink)
|
||||
.headerFetchCompleted(this);
|
||||
this._actionDone();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,23 @@ class ImapIncomingServer extends MsgIncomingServer {
|
|||
: OFFLINE_SUPPORT_LEVEL_REGULAR;
|
||||
}
|
||||
|
||||
get constructedPrettyName() {
|
||||
let identity = MailServices.accounts.getFirstIdentityForServer(this);
|
||||
let email;
|
||||
if (identity) {
|
||||
email = identity.email;
|
||||
} else {
|
||||
email = `${this.username}`;
|
||||
if (this.hostName) {
|
||||
email += `@${this.hostName}`;
|
||||
}
|
||||
}
|
||||
let bundle = Services.strings.createBundle(
|
||||
"chrome://messenger/locale/imapMsgs.properties"
|
||||
);
|
||||
return bundle.formatStringFromName("imapDefaultAccountName", [email]);
|
||||
}
|
||||
|
||||
performBiff(msgWindow) {
|
||||
this.performExpand(msgWindow);
|
||||
}
|
||||
|
@ -330,7 +347,11 @@ class ImapIncomingServer extends MsgIncomingServer {
|
|||
index > 0 ? this._getFolder(newName.slice(0, index)) : this.rootFolder;
|
||||
folder.renameLocal(newName, parent);
|
||||
if (parent instanceof Ci.nsIMsgImapMailFolder) {
|
||||
parent.renameClient(msgWindow, folder, oldName, newName);
|
||||
try {
|
||||
parent.renameClient(msgWindow, folder, oldName, newName);
|
||||
} catch (e) {
|
||||
this._logger.error("renameClient failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
this._getFolder(newName).NotifyFolderEvent("RenameCompleted");
|
||||
|
|
|
@ -227,12 +227,7 @@ add_task(async function test_checkAlert() {
|
|||
let alertText = await gGotAlert;
|
||||
Assert.ok(
|
||||
alertText.startsWith(
|
||||
Services.prefs.getBoolPref("mailnews.imap.jsmodule")
|
||||
? // Not sure why, nsImapIncomingServer.cpp implemented its own
|
||||
// GetConstructedPrettyName. imap-js just uses constructedPrettyName in
|
||||
// MsgIncomingServer.jsm.
|
||||
"The folder 'Inbox on user on localhost' cannot be compacted because another operation is in progress. Please try again later."
|
||||
: "The folder 'Inbox on Mail for ' cannot be compacted because another operation is in progress. Please try again later."
|
||||
"The folder 'Inbox on Mail for ' cannot be compacted because another operation is in progress. Please try again later."
|
||||
)
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче