Fire event when the user changes compose identity
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(thunderbird78+ fixed)
People
(Reporter: dreadnaut, Assigned: darktrojan)
Details
Attachments
(1 file)
8.99 KB,
patch
|
mkmelin
:
review+
wsmwk
:
approval-comm-beta+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Steps to reproduce:
I'm working to port a Thunderbird add-on¹ to MailExtension.
[1] https://addons.thunderbird.net/thunderbird/addon/bordercolors-d/
Actual results:
I can read and write the compose identity with get/setComposeDetails
, but there is no way to know when the user switches identity.
Expected results:
This could be solved by adding a new event in the compose extension API², something like onIdentityUpdated
or onIdentityChanged
.
[2] https://hg.mozilla.org/comm-central/file/tip/mail/components/extensions/parent/ext-compose.js#l380
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
We're not otherwise using the event in MsgComposeCommands.js, so I see no problem in changing it, and the change in onAttachmentRemoved is just correcting an earlier mistake.
Comment 2•4 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/163e5bbcbf51
Fire event when the user changes compose identity. r=mkmelin
Assignee | ||
Updated•4 years ago
|
Comment 4•4 years ago
|
||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Is there any functional change here?
- let event = document.createEvent("Events");
- event.initEvent("compose-from-changed", false, true);
- document.getElementById("msgcomposeWindow").dispatchEvent(event);
+ window.dispatchEvent(new CustomEvent("compose-from-changed"));
There are add-ons using this like window.addEventListener("compose-from-changed", myListener, true);
- That will still work, right?
Comment 6•4 years ago
|
||
It's just the "new" more modern way of doing it. initEvent is deprecated but still working
Comment 7•4 years ago
|
||
Thanks. I understand it now. The bug is about providing this event as a WE API and you took the opportunity to modernise a bit.
Assignee | ||
Comment 9•4 years ago
|
||
(In reply to Jorg K (CEST = GMT+2) from comment #5)
There are add-ons using this like
window.addEventListener("compose-from-changed", myListener, true);
- That will still work, right?
As written that would work, but we're now firing the event on the window not the root element of the document. A minor change is probably necessary.
Comment 10•4 years ago
•
|
||
Assignee | ||
Comment 11•4 years ago
|
||
bugherder uplift |
Thunderbird 78.0b2:
https://hg.mozilla.org/releases/comm-beta/rev/dc0652c2892f
Assignee | ||
Updated•4 years ago
|
Description
•