Bug 1287126 - restore removal of space stuffing removed in changeset 99eb42a1fd3d. r=mkmelin

This commit is contained in:
Jorg K 2016-07-22 13:07:18 +02:00
Родитель 2c1b192c28
Коммит ae10a8a2ec
2 изменённых файлов: 51 добавлений и 0 удалений

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

@ -236,6 +236,51 @@ function test_content_language_header() {
press_delete(mc);
}
/**
* Tests space stuffing of plaintext message.
*/
function test_remove_space_stuffing_format_flowed() {
// Prepare for plaintext email.
let oldHtmlPref = Services.prefs.getBoolPref("mail.identity.default.compose_html");
Services.prefs.setBoolPref("mail.identity.default.compose_html", false);
let cwc = open_compose_new_mail();
setup_msg_contents(cwc, "test@example.invalid",
"Testing space stuffing in plain text email",
"NoSpace\n OneSpace\n TwoSpaces");
cwc.window.SaveAsDraft();
utils.waitFor(() => !cwc.window.gSaveOperationInProgress && !cwc.window.gWindowLock,
"Saving of draft did not finish");
wait_for_window_focused(cwc.window);
close_compose_window(cwc);
be_in_folder(draftsFolder);
let draftMsg = select_click_row(0);
// Wait for the notification with the Edit button.
wait_for_notification_to_show(mc, kBoxId, "draftMsgContent");
plan_for_new_window("msgcompose");
mc.click(mc.eid(kBoxId, {tagName: "button", label: "Edit"}));
cwc = wait_for_compose_window();
let bodyText = cwc.e("content-frame").contentDocument
.querySelector("body").innerHTML;
if (!bodyText.includes("NoSpace<br> OneSpace<br> TwoSpaces")) {
assert_true(false, "Something went wrong with space stuffing");
}
// Clean up the created draft.
press_delete(mc);
Services.prefs.setBoolPref("mail.identity.default.compose_html", oldHtmlPref);
}
function teardownModule() {
MailServices.accounts.localFoldersServer.rootFolder
.propagateDelete(draftsFolder, true, null);

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

@ -182,6 +182,12 @@ MimeMessage_parse_line (const char *aLine, int32_t aLength, MimeObject *obj)
// line in mimeInlineTextPlainFlowedClass.
if (mime_typep(kid, (MimeObjectClass *)&mimeInlineTextPlainFlowedClass))
{
// Remove any stuffed space.
if (length > 0 && ' ' == *line)
{
line++;
length--;
}
return kid->clazz->parse_line (line, length, kid);
}
else