Closed Bug 1876008 Opened 8 months ago Closed 8 months ago

Prepare to drop usage of MsgHdrToMimeMessage in favour of MimeParser.extractMimeMsg() in the WebExtension messages API

Categories

(Thunderbird :: Add-Ons: Extensions API, task)

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
124 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: TbSync, Assigned: TbSync)

References

Details

Attachments

(6 files, 3 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

The messages API currently uses MsgHdrToMimeMessage to parse messages. Since its behavior is heavily coupled to Thunderbird preferences and message attributes (like junk status), its outcome is not deterministic and sometimes unexpected. Some body parts are eaten, and others are returned after being passed through a convertToHTml() function, altering the original body (see nsISimpleMimeConverter.idl).

For various reasons, I created MimeParser.extractMimeMsg() for Thunderbird 102, which is a pure mime parser independent of any Thunderbird specialities.

I want to completely switch to this parser now. The following items have to be checked:

  • allow encryption using this and this (thanks Kai!)
  • figure out the reasons for the difference in size calculations
Blocks: 1854684

I want to replace MsgHdrToMimeMessage by a pure js parser, which does not have
to deal with Thunderbird specialities. The added method allows to use message
streams as input, so we do not have to extract the raw message first.

Assignee: nobody → john
Status: NEW → ASSIGNED

When this was originally created, I copied some guessing code from Thunderbird.
I no longer want to use it and instead honor the contentDisposition header. With
the old code in place, a mime part of type 'text/calendar' which is NOT marked as
an attachment, is still returned as an attachment.

Depends on D199337

Attachment #9375968 - Attachment description: Bug 1876008 - Introduce MimeParser.extractMimeMsgAsync() and move ExtractMimeMsgEmitter into a class. r=mkmelin → Bug 1876008 - Introduce MimeParser.streamMimeMsg() and move ExtractMimeMsgEmitter into a class. r=mkmelin

Comment on attachment 9375979 [details]
Bug 1876008 - Be strict on the contentDisposition header and no longer guess attachments. r=mkmelin

Revision D199342 was moved to bug 1737532. Setting attachment 9375979 [details] to obsolete.

Attachment #9375979 - Attachment is obsolete: true
Attachment #9376397 - Attachment is obsolete: true
Attachment #9376442 - Attachment description: WIP: Bug 1876008 - Move crypto functions related to MimeTree into a dedicated module. → Bug 1876008 - Move crypto functions related to MimeTree into a dedicated module. r=mkmelin,kaie

To make review of D199624 easier, code copied from one file to
another was not removed but commented. Removing it now.

Depends on D199624

This function is a utility function and does not need to be part of the
class.

Depends on D199629

This is an effort to increase readability of this module, by using
descriptive parameter names.

Depends on D199630

Our codebase uses many different jsmime emitters with similar code.
A base class others can derive from could be beneficial. This patch
moves the existing emitter used by mimeTree.sys.mjs into a class
without changing its current behaviour.

Depends on D199631

Attachment #9376707 - Attachment description: WIP: Bug 1876008 - Extend MimeTreeEmitter base class, remove dublicated code in ExtractMimeMsgEmitter and add basic support for decryption. → WIP: Bug 1876008 - Derive ExtractMimeMsgEmitter from the MimeTreeEmitter base class and add basic support for decryption.
Summary: Evaluate to drop usage of MsgHdrToMimeMessage in favour of MimeParser.extractMimeMsg(). → Prepare to drop usage of MsgHdrToMimeMessage in favour of MimeParser.extractMimeMsg() in the WebExtension messages API
Blocks: 1878620

Comment on attachment 9376707 [details]
WIP: Bug 1876008 - Derive ExtractMimeMsgEmitter from the MimeTreeEmitter base class and add basic support for decryption.

Revision D199758 was moved to bug 1878620. Setting attachment 9376707 [details] to obsolete.

Attachment #9376707 - Attachment is obsolete: true
Keywords: leave-open
Target Milestone: --- → 124 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/989e6f7f2436
Move crypto functions related to MimeTree into a dedicated module. r=kaie
https://hg.mozilla.org/comm-central/rev/3bf17ff35910
Remove leftover functions from D199624. r=mkmelin,kaie
https://hg.mozilla.org/comm-central/rev/c03d4f8f77b5
Move stripHTMLFromArmoredBlocks() out of MimeTreeDecrypter class. r=kaie
https://hg.mozilla.org/comm-central/rev/d3f543fdcaf1
Rename input parameters of functions handling MimeTreeParts to mimeTreePart. r=kaie
https://hg.mozilla.org/comm-central/rev/5232c59e813f
Introduce a MimeTreeEmitter base class. r=kaie
https://hg.mozilla.org/comm-central/rev/a316d2940243
Introduce MimeParser.streamMimeMsg() and move ExtractMimeMsgEmitter into a class. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
No longer blocks: 1854684
No longer blocks: 1737532
No longer blocks: 1878620
Blocks: 1854684
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: