Closed Bug 1642522 Opened 1 month ago Closed 1 month ago

"this._attachmentIds.get(...) is undefined" in ext-compose.js

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect

Tracking

(thunderbird78 fixed)

RESOLVED FIXED
Thunderbird 79.0
Tracking Status
thunderbird78 --- fixed

People

(Reporter: darktrojan, Assigned: darktrojan)

Details

Attachments

(1 file)

If the compose API is used but not for attachments, every time a compose window is closed it tries to forget attachments it wasn't remembering.

This is the easiest thing I've had to fix in a while. :-/

Attachment #9153289 - Flags: review?(mkmelin+mozilla)
Attachment #9153289 - Flags: approval-comm-beta?

(In reply to Geoff Lankow (:darktrojan) from comment #0)

If the compose API is used but not for attachments, every time a compose window is closed it tries to forget attachments it wasn't remembering.

I don't understand what it's doing then. Seems this is called only once: https://searchfox.org/comm-central/rev/eaa4c5e724230d661b587d05cabfd485ecad84df/mail/components/extensions/parent/ext-compose.js#337

So it's calling the function with some junk? Or why wasn't it remembering them?

They're only in that Map if an extension has done something with attachments. The forgetAttachments call is made whether or not there's attachments in the Map.

Comment on attachment 9153289 [details] [diff] [review]
1642522-forget-attachment-undefined.diff

Review of attachment 9153289 [details] [diff] [review]:
-----------------------------------------------------------------

::: mail/components/extensions/parent/ext-compose.js
@@ +322,5 @@
>      return this._attachments.has(id);
>    },
>  
>    forgetAttachment(attachment) {
> +    let id = this._attachmentIds.get(attachment)?.id;

Please add a code comment about it.

@@ +327,1 @@
>      this._attachmentIds.delete(attachment);

Seems this should also be in the if clause. Pointless to try to delete if it wasn't there.
Attachment #9153289 - Flags: review?(mkmelin+mozilla) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/eac3756825da
Fix "this._attachmentIds.get(...) is undefined" in ext-compose.js. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 79.0
Comment on attachment 9153289 [details] [diff] [review]
1642522-forget-attachment-undefined.diff

[Triage Comment]
Approved for beta
Attachment #9153289 - Flags: approval-comm-beta? → approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.