Add/remove/update attachment functions don't work in onBeforeSend listener
Categories
(Thunderbird :: Add-Ons: Extensions API, defect, P2)
Tracking
(thunderbird_esr78+ fixed, thunderbird81 affected)
People
(Reporter: darktrojan, Assigned: darktrojan)
References
Details
(Whiteboard: [TB 78.4.0])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
wsmwk
:
approval-comm-esr78+
|
Details |
This should work, but it doesn't appear to:
browser.compose.onBeforeSend.addListener((tab, details) =>
browser.compose.addAttachment(tab.id, { file: new File(["foo bar"], "foobar.txt") })
)
Assignee | ||
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
I tested this by manually applying the patch, but it does not work. Also the workaround suggested in the topicbox thread does not work. Not in TB78 and also not in tip. This is the used background.js:
function listener (tab, details) {
console.log(tab);
console.log(details);
let file = new File(["Some example text."], "test.txt");
browser.compose.addAttachment(tab.id, { file });
return { details: {} };
}
browser.compose.onBeforeSend.addListener(listener);
The attachment is added to the tab, I can see it, but it is not send.
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
browser.compose.addAttachment(tab.id, { file });
You didn't await
this. The listener's returning immediately and sending continues.
Comment 4•4 years ago
|
||
Ouch. Making the listener an async function and awaiting addAttachmant
indeed works. The patch than of course also works in tip and the attachment is added without the need to return an empty details obj.
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/bb4a328d217e
Fix modification of attachments from a onBeforeSend listener. r=john.bieling
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Comment on attachment 9173254 [details]
Bug 1662015 - Fix modification of attachments from a onBeforeSend listener. r?mkmelin
[Approval Request Comment]
WX API correctness fix. Should go to 78 at some point.
Comment 7•4 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #6)
WX API correctness fix. Should go to 78 at some point.
needs to go with bug 1662018
Comment 8•4 years ago
|
||
Comment on attachment 9173254 [details]
Bug 1662015 - Fix modification of attachments from a onBeforeSend listener. r?mkmelin
[Triage Comment]
Approved for esr78
needs to go with bug 1662018
Comment 9•4 years ago
|
||
bugherder uplift |
Thunderbird 78.3.2:
https://hg.mozilla.org/releases/comm-esr78/rev/dd30b0e81498
Updated•4 years ago
|
Comment 10•4 years ago
|
||
backout bugherder uplift |
Backout 78.3.2:
https://hg.mozilla.org/releases/comm-esr78/rev/ab7d41cf420f
Updated•4 years ago
|
Assignee | ||
Comment 11•4 years ago
|
||
Resetting this bug to fixed so that it shows in uplift queries again.
Comment 12•4 years ago
|
||
bugherder uplift |
Thunderbird 78.4.0:
https://hg.mozilla.org/releases/comm-esr78/rev/e86b55a8ae20
Comment 13•4 years ago
|
||
Given the problems this fix creates, I think this was not a bug, but a feature: https://thunderbird.topicbox.com/groups/addons/Te2def0724ea335a2-M732d299345ca3eb0ecca1de2/theres-still-a-problem-with-attachments-in-onbeforesend
Comment 14•4 years ago
|
||
See also bug 1671835, bug 1669829, bug 1669831, bug 1669897.
Description
•