Mail Extension compose.onBeforeSend returning a mailing list fails
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr68 unaffected, thunderbird75 fixed, thunderbird76 fixed)
Tracking | Status | |
---|---|---|
thunderbird_esr68 | --- | unaffected |
thunderbird75 | --- | fixed |
thunderbird76 | --- | fixed |
People
(Reporter: dave, Assigned: darktrojan)
References
Details
Attachments
(2 files)
(deleted),
patch
|
mkmelin
:
review+
wsmwk
:
approval-comm-beta+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mkmelin
:
review+
wsmwk
:
approval-comm-beta+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
As mentioned in topicbox forum:
https://thunderbird.topicbox.com/groups/addons/T5d6979f2417f424c-M03013aee0a804913c76604c3/compose-onbeforesend-returned-object-format
Summary:
Using compose.onBeforeSend, not cancelling the send, and returning a mailing list in the [details] object fails "syntax error in parameters or arguments"
Screenshot:
https://revad.github.io/shared/Change_lint_to_BCC_Screenshot_2020-02-26_13-57-58.png
Object returned was
New obj:{"details":{"to":[],"cc":[],"bcc":["List_of_2_valid <List_of_2_valid>"],"replyTo":[],"followupTo":[],"newsgroups":[],"subject":"Test 2"},"cancel":false}
It doesn't make any difference whether you move the object to BCC or not.
(I also tried returning an object-formatted mailing list - that failed too.)
Addon I'm testing:
https://github.com/revad/limit_non-BCC_recipients
Assignee | ||
Comment 1•5 years ago
|
||
I think I have found the problem. Mailing lists are not expanded before the onBeforeSend event fires, but this needs to happen afterwards in case the event changes the recipient list. So Thunderbird is trying to send to List_of_2_valid@your.domain
instead of to the members of the list.
Assignee | ||
Comment 2•5 years ago
|
||
Actually the same applies if there is any onBeforeSend listener, regardless of whether the listener changes anything.
Assignee | ||
Comment 3•5 years ago
|
||
As always, 1 line of fix, 150 lines of test. I've also tidied up a few loose edges in the same test.
Assignee | ||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
Expansion happens before our event which accidentally cancels it out by calling Recipients2CompFields
again (via GetComposeDetails
).
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/0dac4d205acc
Expand mailing lists after onBeforeSend event fires. r=mkmelin
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder uplift |
Thunderbird 75.0b2:
https://hg.mozilla.org/releases/comm-beta/rev/1041f7d332c1
Updated•5 years ago
|
Reporter | ||
Comment 10•5 years ago
|
||
This was fixed, but it's happening again in 76.0b1 and 77
Comment 11•5 years ago
|
||
Anything special about it? I suspect bug 1629103 but I can't reproduce so far.
Reporter | ||
Comment 12•5 years ago
|
||
I'm repeating the same test with the same list ("List_of_2_valid") as in the OP.
I return this from compose.onBeforeSend :
Returned compose object:{"cancel":false}
The result is exactly as in the screenshot in the OP.
The list contains, as its name suggests, 2 valid addresses.
Reporter | ||
Comment 13•5 years ago
|
||
I was using my addon:
https://addons.thunderbird.net/en-US/thunderbird/addon/limit-non-bcc-recipients/
I set the non-BCC limit in my prefs to 1 and the list contains 2 recipients so I get a warning.
If I select 'Send anyway' I get the error.
But if I select 'Send anyway' and 'Change all to BCC' it works.
The error happens when there is no 'details' key in the returned object, only a 'cancel' key - as in my comment 12. If I set ['details'] = {} it works.
I used to pass the original unchanged details back, adding the 'cancel' key - as in comment 1. But when 'body' 'plainTextBody' and 'isPlainText' was added to the API that stopped working (some message about 'you can't have both plaintext and html' IIRC). I fixed that by only passing changed fields.
So the 'details' key is mandatory. Or TB should treat its absence as 'no changes'.
Assignee | ||
Comment 14•5 years ago
|
||
I think I can see what that problem is.
Assignee | ||
Comment 15•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/cffb0a855c7b
Expand mailing lists even if browser.compose.onBeforeSend listener returns nothing. r=mkmelin
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
bugherder uplift |
Thunderbird 76.0b3:
https://hg.mozilla.org/releases/comm-beta/rev/9ef0d5ece977
Updated•5 years ago
|
Description
•