Support for raw message source in WebExtensions messages API
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement, P2)
Tracking
(thunderbird_esr68 fixed)
Tracking | Status | |
---|---|---|
thunderbird_esr68 | --- | fixed |
People
(Reporter: liliakai, Assigned: darktrojan)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
mkmelin
:
review+
wsmwk
:
approval-comm-esr68+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Steps to reproduce:
In TB67, browser.messages.getFull
will return a JS object representing the parsed mime message.
As an extension developer, I want an API to retrieve the original raw message source, meaning a single Blob containing the full headers and mime-encoded contents, as rendered when selecting "View Source" in the UI.
Assignee | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Can you provide some uses cases you are looking to fulfill with a raw API?
I maintain a web extension which submits suspicious emails to a 3rd party service for analysis. The service expects raw mime-encoded emails as input.
I want to do the same thing.... are you possibly talking about the postmark spam check?
I need it for DKIM verification. There I need to calculate a hash over the complete body, and some header fields.
For that I need the complete body as one big unparsed blob (with things like whitespace preserved).
The header fields I also need unparsed, with whitespace (including newlines if it goes over multiple lines) preserved. And if a header field exist multiple times, I need to get them in the same order as in the mail.
Haven't yet looked in detail at the existing web extension API for getting the headers. Could be that it is sufficient for me for getting the headers.
For me it is unimportant whether I get the complete mail as one block (and do the parsing of the headers myself), or just the complete body, and a separate API for getting the (unparsed) header values for the header fileds.
Comment 5•5 years ago
|
||
Thanks for the use cases folks. I'm wondering if it makes sense to consolidate get
and getFull
into one function, e.g.
messenger.messages.get(messageId);
messenger.messages.get(messageId, { mode: "full" });
messenger.messages.get(messageId, { mode: "raw" });
A similar option could be supported in the query
and list
functions. I'm also not sure what full in getFull
means in this context. If raw is fuller than full, maybe it makes sense to use something more explicit?
my guess is that "full" at least in this context means the complete message, which includes headers and body not just the body or the messageID
Assignee | ||
Comment 7•5 years ago
|
||
I've stared on this and have a mostly working patch that adds a getRaw
function. I don't think it's a good idea to return raw messages for queries as there's a cost to getting them (potentially including downloading from the server, depending on the settings).
Marvin's going to look at writing some tests if we can get him set up to build things.
Assignee | ||
Comment 8•5 years ago
|
||
Comment 9•5 years ago
|
||
Assignee | ||
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/0658b2e48cab
Support for raw message source in WebExtensions messages API; r=mkmelin
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
Thunderbird 68.7: https://hg.mozilla.org/releases/comm-esr68/rev/43c0d5aa25e181cbe41670cbef9b5844b1a5ce39
Description
•