compose API function beginForward ignores ComposeDetails
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr78 fixed)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | fixed |
People
(Reporter: janek, Assigned: darktrojan)
Details
Attachments
(1 file)
47 bytes,
text/x-phabricator-request
|
wsmwk
:
approval-comm-esr78+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Steps to reproduce:
A call to
browser.compose.beginForward(msg.id,
"forwardInline",
{ "identityId": identityId });
ignores the identityId. In a
Actual results:
Composer is opened with the default identity selected as sender
Expected results:
The composer should open with the sender that corresponds to the id given in the ComposeDetails param.
The issue is this code in mail/components/extensions/parent/ext-compose.js:
if (type == Ci.nsIMsgCompType.ForwardInline) {
let msgHdr = null;
let msgURI = null;
let hdrIdentity = null;
if (relatedMessageId) {
msgHdr = messageTracker.getMessage(relatedMessageId);
msgURI = msgHdr.folder.getUriForMsg(msgHdr);
}
let newWindowPromise = waitForWindow();
MailServices.compose.OpenComposeWindow(
null,
msgHdr,
msgURI,
type,
0,
hdrIdentity,
null,
null
);
return newWindowPromise;
Instead of assigning null to hdrIdentity in line 73 (let hdrIdentity = null;) it should use resolve the identity for details.identityId and use that:
if (details.identityId !== null) {
if (!extension.hasPermission("accountsRead")) {
throw new ExtensionError(
'Using identities requires the "accountsRead" permission'
);
}
let identity = MailServices.accounts.allIdentities.find(
i => i.key == details.identityId
);
if (!identity) {
throw new ExtensionError(`Identity not found: ${details.identityId}`);
}
let hdrIdentity = identity;
Assignee | ||
Comment 1•4 years ago
|
||
Yeah, that's broken. I've tried to patch it up but some things just aren't possible at the moment.
Assignee | ||
Comment 2•4 years ago
|
||
I've come up with a reasonable work-around, so I'm going to recycle this bug and put it here, since bug numbers are finite and we shouldn't waste them. ;-)
Also I've just realised I didn't read the original message properly and you offered a partial solution. Sorry about that.
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/b8d5b08f8fa6
Fix forwarding inline via API by setting details after the compose window opens. r=mkmelin
Assignee | ||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Comment on attachment 9182833 [details]
Bug 1658657 - Fix forwarding inline via API by setting details after the compose window opens. r?mkmelin
[Approval Request Comment]
User impact if declined:
In general: Add-on developers can not use the latest fixes and improvements of our WebExtension API.
Specifically this bug: Bug 1658132 (which is an API fix) needs this bug to be uplifted as well.
Testing completed (on c-c, etc.):
https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=3cdff293d5d1bd77777f5da371caaa02c4b05de3
Risk to taking this patch (and alternatives if risky):
I hope none
Remark:
The provided try run includes all bugs I want to uplift for TB 78.7 and shows a working patch order.
Bug 1680653 is the first one, who does not have a bug number in the commit message.
This is the second one.
Comment 6•4 years ago
|
||
Comment on attachment 9182833 [details]
Bug 1658657 - Fix forwarding inline via API by setting details after the compose window opens. r?mkmelin
[Triage Comment]
Approved for esr78
Comment 7•4 years ago
|
||
bugherder uplift |
Thunderbird 78.7.0:
https://hg.mozilla.org/releases/comm-esr78/rev/6902aa15e2fb
Description
•