Running compose.getComposeDetails() followed by compose.setComposeDetails() in a WebExtension deletes the quoted reply in plainText mode.
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr102+ fixed, thunderbird109 fixed)
People
(Reporter: nelia.collins, Assigned: TbSync)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
1.11 KB,
application/x-xpinstall
|
Details | |
48 bytes,
text/x-phabricator-request
|
wsmwk
:
approval-comm-beta+
wsmwk
:
approval-comm-esr102+
|
Details | Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Steps to reproduce:
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.5.1
I have a webextension that adds a header and footer to outgoing messages. Starting with Thunderbird 102, when using this extension, it adds the header and footer but deletes the quoted reply in plaintext messages.
I attached an extension that reproduces the issue I'm seeing with my actual extension. The essential part is that it has a line
let details = await browser.compose.getComposeDetails(tabId);
followed by
await browser.compose.setComposeDetails(tabId, { plainTextBody: details.plainTextBody });
Steps to reproduce the problem:
-
Install an addon that updates the message body as above using an onBeforeSend listener. (Example attached.)
-
Reply to an existing message using plaintext format. (If your default is to send html messages, hold down the Shift key while clicking the Reply button to begin composing a plaintext message.)
-
Compose your message and click Send.
Actual results:
The quoted reply in the message (all lines following the line "On 12/8/22 15:05, XX YY wrote:" and beginning with the character ">") vanishes.
Expected results:
The message text should have been unchanged.
For what it's worth: if I update the attachment so that it inserts a space before the ">" on the lines of the reply, then those lines do not vanish.
Assignee | ||
Comment 2•2 years ago
|
||
This is very unexpected. I know I fixed this in Bug 1674830 (as in "I have seen it working"), but moz-regression clearly shows that it is not working at all since that patch landed.
Assignee | ||
Comment 3•2 years ago
|
||
Ah, it is not working in the onBeforeSend event, but does work as expected elsewhere. For example, in an onClicked event:
browser.composeAction.onClicked.addListener(async (tab) => {
let details = await browser.compose.getComposeDetails(tab.id);
details.plainTextBody = "Pre Text\n\n" + details.plainTextBody + "\n\nPost Text";
await browser.compose.setComposeDetails(tab.id, details);
console.log(details);
});
Thanks for your report, I will investigate why this is happening.
Assignee | ||
Comment 4•2 years ago
|
||
Assignee | ||
Comment 5•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/d91f2c174081
Remove read-only flag from editor before using InsertTextWithQuotations(). r=aleca
Assignee | ||
Comment 7•2 years ago
|
||
Comment on attachment 9308666 [details]
Bug 1804796 - Remove read-only flag from editor before using InsertTextWithQuotations(). r=#thunderbird-reviewers
[Approval Request Comment]
Regression caused by (bug #):
1674830
User impact if declined:
Quoted text is stripped when a message is manipulated by add-ons in the onBeforeSend event (no way for the user to prevent sending the stripped message).
Testing completed (on c-c, etc.):
Just landed on Daily.
Risk to taking this patch (and alternatives if risky):
Very low. We simply toggle the read-only flag of the editor before and after manipulating the editor. I would like to get this on ESR as fast as possible.
Comment 8•2 years ago
|
||
Comment on attachment 9308666 [details]
Bug 1804796 - Remove read-only flag from editor before using InsertTextWithQuotations(). r=#thunderbird-reviewers
[Triage Comment]
Approved for beta
Comment 9•2 years ago
|
||
bugherder uplift |
Thunderbird 109.0b2:
https://hg.mozilla.org/releases/comm-beta/rev/e7b5f20df0ea
Updated•2 years ago
|
Assignee | ||
Comment 10•2 years ago
|
||
Comment on attachment 9308666 [details]
Bug 1804796 - Remove read-only flag from editor before using InsertTextWithQuotations(). r=#thunderbird-reviewers
[Approval Request Comment]
Regression caused by (bug #):
1674830
User impact if declined:
Quoted text is stripped when a message is manipulated by add-ons in the onBeforeSend event (no way for the user to prevent sending the stripped message).
Testing completed (on c-c, etc.):
1 month on Beta.
Risk to taking this patch (and alternatives if risky):
Very low. We simply toggle the read-only flag of the editor before and after manipulating the editor.
Comment 11•2 years ago
|
||
Comment on attachment 9308666 [details]
Bug 1804796 - Remove read-only flag from editor before using InsertTextWithQuotations(). r=#thunderbird-reviewers
[Triage Comment]
approved for esr102
Comment 12•2 years ago
|
||
bugherder uplift |
Thunderbird 102.7.1:
https://hg.mozilla.org/releases/comm-esr102/rev/47a6139bab77
Description
•