Bug 1211292 - Enable remaining composition mochitests for MessageSend.jsm. r=mkmelin

This commit is contained in:
Ping Chen 2020-09-28 10:13:52 +09:00
Родитель d45101f665
Коммит dcb83bbdf8
13 изменённых файлов: 48 добавлений и 28 удалений

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

@ -46,24 +46,4 @@ skip-if = os == 'linux' && bits == 32 && debug # Perma-fail
subsuite = thunderbird
support-files = data/**
[browser_imageDisplay.js]
[browser_imageInsertionDialog.js]
[browser_multipartRelated.js]
[browser_newmsgComposeIdentity.js]
[browser_replyAddresses.js]
skip-if = debug # Bug 1601591
[browser_replyCatchAll.js]
[browser_replyFormatFlowed.js]
[browser_replyMultipartCharset.js]
skip-if = debug # Bug 1606542
[browser_replySignature.js]
[browser_saveChangesOnQuit.js]
[browser_sendButton.js]
tags = addrbook
skip-if = os == 'win' && bits == 64 && debug # Bug 1601520
[browser_sendFormat.js]
tags = addrbook
[browser_signatureInit.js]
[browser_signatureUpdating.js]
[include:browser-shared.ini]

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

@ -19,4 +19,23 @@ reason = See bug 1413851.
[browser_forwardUTF8.js]
[browser_forwardedContent.js]
[browser_forwardedEmlActions.js]
[browser_imageDisplay.js]
[browser_imageInsertionDialog.js]
[browser_multipartRelated.js]
[browser_newmsgComposeIdentity.js]
[browser_quoteMessage.js]
[browser_replyAddresses.js]
skip-if = debug # Bug 1601591
[browser_replyCatchAll.js]
[browser_replyFormatFlowed.js]
[browser_replyMultipartCharset.js]
skip-if = debug # Bug 1606542
[browser_replySignature.js]
[browser_saveChangesOnQuit.js]
[browser_sendButton.js]
tags = addrbook
skip-if = os == 'win' && bits == 64 && debug # Bug 1601520
[browser_sendFormat.js]
tags = addrbook
[browser_signatureInit.js]
[browser_signatureUpdating.js]

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

@ -47,6 +47,7 @@ async function forwardDirect(aFilePath, aExpectedText) {
// Ctrl+S saves as draft.
cwc.keypress(null, "s", { shiftKey: false, accelKey: true });
waitForSaveOperation(cwc);
close_compose_window(cwc);
close_window(msgc);

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

@ -112,6 +112,7 @@ add_task(function test_basic_multipart_related() {
// Ctrl+S = save as draft.
compWin.keypress(null, "s", { shiftKey: false, accelKey: true });
waitForSaveOperation(compWin);
close_compose_window(compWin);
// Make sure that the headers are right on this one.

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

@ -254,6 +254,7 @@ add_task(function test_display_of_identities() {
// Bug 1152045, check that the email address from the selected identity
// is properly used for the From field in the created message.
cwc.window.SaveAsDraft();
waitForSaveOperation(cwc);
close_compose_window(cwc);
be_in_folder(gDrafts);

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

@ -51,6 +51,7 @@ async function subtest_reply_format_flowed(aFlowed) {
// Now save the message as a draft.
cwc.keypress(null, "s", { shiftKey: false, accelKey: true });
waitForSaveOperation(cwc);
close_compose_window(cwc);
// Now check the message content in the drafts folder.

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

@ -81,6 +81,11 @@ interface nsIMsgAttachment : nsISupports {
*/
attribute string contentTypeParam;
/**
* Content-ID for embedded attachments inside a multipart/related container.
*/
attribute AUTF8String contentId;
/**
* charset attribute
*

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

@ -548,6 +548,7 @@ MessageSend.prototype = {
"@mozilla.org/messengercompose/attachment;1"
].createInstance(Ci.nsIMsgAttachment);
attachment.name = name || MsgUtils.pickFileNameFromUrl(url);
attachment.contentId = cid;
attachment.url = url;
embeddedAttachments.push(attachment);
}

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

@ -83,7 +83,7 @@ class MimeMessage {
* @returns {MimePart}
*/
_initMimePart() {
let [plainPart, htmlPart] = this._gatherMainParts();
let { plainPart, htmlPart } = this._gatherMainParts();
let embeddedParts = this._gatherEmbeddedParts();
let attachmentParts = this._gatherAttachmentParts();
@ -273,7 +273,7 @@ class MimeMessage {
/**
* Determine if the message should include an HTML part, a plain part or both.
* @returns {MimePart[]}
* @returns {{plainPart: MimePart, htmlPart: MimePart}}
*/
_gatherMainParts() {
let formatFlowed = Services.prefs.getBoolPref(
@ -287,7 +287,7 @@ class MimeMessage {
let htmlPart = null;
let plainPart = null;
let parts = [];
let parts = {};
if (this._bodyType === "text/html") {
htmlPart = new MimePart(
@ -308,7 +308,7 @@ class MimeMessage {
`text/plain; charset=UTF-8${formatParam}`
);
plainPart.bodyText = this._bodyText;
parts.push(plainPart);
parts.plainPart = plainPart;
}
// Assemble a multipart/alternative message.
@ -332,7 +332,7 @@ class MimeMessage {
formatFlowed
);
parts.push(plainPart);
parts.plainPart = plainPart;
}
// If useMultipartAlternative is true, send multipart/alternative message.
@ -342,7 +342,7 @@ class MimeMessage {
(plainPart && this._compFields.useMultipartAlternative) ||
!plainPart
) {
parts.push(htmlPart);
parts.htmlPart = htmlPart;
}
}
@ -386,7 +386,7 @@ class MimeMessage {
_gatherEmbeddedParts() {
return this._embeddedAttachments.map(attachment => {
let part = new MimePart(null, this._compFields.forceMsgEncoding, false);
part.setBodyAttachment(attachment);
part.setBodyAttachment(attachment, "inline", attachment.contentId);
return part;
});
}

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

@ -143,6 +143,16 @@ NS_IMETHODIMP nsMsgAttachment::SetContentTypeParam(
return NS_OK;
}
NS_IMETHODIMP nsMsgAttachment::GetContentId(nsACString& aContentId) {
aContentId = mContentId;
return NS_OK;
}
NS_IMETHODIMP nsMsgAttachment::SetContentId(const nsACString& aContentId) {
mContentId = aContentId;
return NS_OK;
}
/* attribute string charset; */
NS_IMETHODIMP nsMsgAttachment::GetCharset(char** aCharset) {
NS_ENSURE_ARG_POINTER(aCharset);

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

@ -29,6 +29,7 @@ class nsMsgAttachment : public nsIMsgAttachment {
nsCString mContentLocation;
nsCString mContentType;
nsCString mContentTypeParam;
nsCString mContentId;
nsCString mCharset;
nsCString mMacType;
nsCString mMacCreator;

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

@ -7,6 +7,5 @@ support-files = data/*
# No need to enable this for MessageSend.jsm because tmp file is not used for
# attachment.
[test_bug235432.js]
[test_sendMailAddressIDN.js]
[include:xpcshell-shared.ini]

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

@ -18,6 +18,7 @@ skip-if = os == 'mac'
[test_nsSmtpService1.js]
[test_saveDraft.js]
[test_sendBackground.js]
[test_sendMailAddressIDN.js]
[test_sendMailMessage.js]
[test_sendMessageFile.js]
[test_sendMessageLater.js]