messages.getFull don't reject upon failure
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr78 fixed)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | fixed |
People
(Reporter: benc, Assigned: darktrojan)
References
Details
Attachments
(2 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
patch
|
wsmwk
:
approval-comm-esr78+
|
Details | Diff | Splinter Review |
(This arose as Part of Bug 1644027, but isn't the cause. You can find steps to reproduce over there - there's a simple extension posted in the first few comments).
messages.getFull()
and messages.getRaw()
are failing (on news messages), but not causing an exception/rejection/whatever.
Just looking at getFull()
, it calls MsgHdrToMimeMessage()
, which is throwing an exception. But getFull() doesn't handle it.
I'm a little fuzzy on error handling/thowing in promises. I guess it's a case of wrapping a try block around and calling reject()
if an error is thrown. But that seems awfully laborious... And I'll bet it's a reasonably common occurrence throughout the extension API, so maybe there's some way to handle such cases more generally?
getFull():
https://searchfox.org/comm-central/source/mail/components/extensions/parent/ext-messages.js#212
MsgHdrToMimeMessage():
https://searchfox.org/comm-central/source/mailnews/db/gloda/modules/MimeMessage.jsm#247
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Actually MsgHdrToMimeMessage
is not throwing, it's just passing null
to the callback which isn't helpful. We can take that as a sign of failure and reject.
Assignee | ||
Comment 2•4 years ago
|
||
This brings the result of MsgHdrToMimeMessage out to the main function and throws if it's null.
It should prevent convertMessagePart failing but if it does the failure will at least be returned to the extension.
Updated•4 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/4181feb3184d
Handle null result from MsgHdrToMimeMessage in messages API. r=john.bieling
Assignee | ||
Comment 4•4 years ago
|
||
For anybody wondering, John is changing getRaw
in bug 1696884 so I didn't touch it.
The fix is neat, however since this bug is closed, should not "getFull" be removed from the title? The same question is to "Blocks" relation to the Bug #1696884.
Updated•4 years ago
|
Comment 6•4 years ago
|
||
78 uplift?
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Yes, I will prepare a patch.
Comment 8•4 years ago
|
||
Patch for TB78
Comment 9•4 years ago
|
||
Comment on attachment 9218950 [details] [diff] [review]
bug1697075_Handle_null_result_from_MsgHdrToMimeMessage_in_messages_API_ESR78.patch
[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
unexpected API fails
Testing completed (on c-c, etc.):
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=2614ffa5c34e6223d22b4935467d9602f2ec0105
Risk to taking this patch (and alternatives if risky):
Low
Comment 10•4 years ago
|
||
Comment on attachment 9218950 [details] [diff] [review]
bug1697075_Handle_null_result_from_MsgHdrToMimeMessage_in_messages_API_ESR78.patch
[Triage Comment]
Approved for esr78
Comment 11•4 years ago
|
||
bugherder uplift |
Thunderbird 78.10.2:
https://hg.mozilla.org/releases/comm-esr78/rev/ec2f7152e3a2
Description
•