Closed Bug 1681477 Opened 10 months ago Closed 4 months ago

Add-ons API: onNewMailReceived Event returns message list containing messages from previous event

Categories

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

x86_64
Windows 10
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 375717

People

(Reporter: dark_screem, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0

Steps to reproduce:

  1. Create empty extension
  2. add background script containing
    <code>browser.messages.onNewMailReceived.addListener(function(folder, messageList) {

if(folder.accountId == "account1") {
if(folder.path == "/INBOX") {

    console.log("Folder", typeof folder, folder);
    console.log("MessageList", typeof messageList, messageList);

    let messages = messageList.messages;

    for(let i = 0; i < messages.length; i++) {
        
        let message = messages[i];

        console.log("Message", typeof message, message);
        message.flagged = true;
    }

    messageList.messages = [];
} else {    
    // Ignored not in inbox
}

} else {
// Ignored
}
});</code>
3. Recieve mail

Actual results:

Each time the event will trigger new Messages will be in. But also allready marked as "read" emails are also remain in the given messageList and/or mails from previous events are still in messageList.

Expected results:

Only new mails or not read mails should be in the messageList but not mails from previous calls.

Maybe its a bug or should be mentioned in documentation.

OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

Well - unfortunately - that's how it works for Thunderbird in general as well. Not just the API I mean. There's a bug...

Sounds like yeah thanks for issuing but live with that... or do I misinterpret?

I'm saying we need to fix bug 375717 first, before it could work for APIs. Maybe it automatically would fix it.

Depends on: 375717

Oh yeah might be, thanks for the hint :-D

Confirming symptoms based on reporter's comment 0 - as Magnus said, fixing bug 375717 may fix this.

Hi dark_screen, for the avoidance of doubt, the actual biff notification (which is then reflected in the add-ons API) is a PITA and you're quite right it's showing messages from previous rounds, which makes it so confusing. We have someone working on the underlying problems, but it's definitely non-trivial to fix.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: onNewMailReceived Event returns message list containing messages from previous event → Add-ons API: onNewMailReceived Event returns message list containing messages from previous event

Bug 375717 has been fixed and backported to TB78. I no longer see the reported issue.

Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 375717
You need to log in before you can comment on or make changes to this bug.