Closed Bug 1931928 Opened 20 days ago Closed 19 days ago

ext-messages.js reports "Error reading message" for a message that was moved away by a filter (or junk processing)

Categories

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

Thunderbird 128
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1855486

People

(Reporter: KaiE, Unassigned)

Details

The extension API code throws messages on the error console.

"Error reading message" from here:
https://searchfox.org/comm-esr128/rev/ff97246964dffb90d59d9be6120a03e01d9d4f2f/mail/components/extensions/parent/ext-messages.js#590

Stack:

WebExtensions: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIMsgMessageService.streamMessage]
    messagePromise resource:///modules/ExtensionMessages.sys.mjs:463
    getOriginalMessage resource:///modules/ExtensionMessages.sys.mjs:422
    getDecryptedTree resource:///modules/ExtensionMessages.sys.mjs:531
    getFull chrome://messenger/content/parent/ext-messages.js:586
    result resource://gre/modules/ExtensionParent.sys.mjs:1221
    withCallContextData resource://gre/modules/ExtensionParent.sys.mjs:664
    result resource://gre/modules/ExtensionParent.sys.mjs:1220
    withPendingBrowser resource://gre/modules/ExtensionParent.sys.mjs:674
    result resource://gre/modules/ExtensionParent.sys.mjs:1219
    callAndLog resource://gre/modules/ExtensionParent.sys.mjs:1170
    recvAPICall resource://gre/modules/ExtensionParent.sys.mjs:1218
ext-messages.js:592

Based on logging I've added, the message refers to a new message from POP3 that was added just a moment ago, but has already been moved out of the folder, either by a filter or by junk message processing.

When fixing this bug, I suggest to also add the URL to the error statements, e.g.

let uri = msgHdr.folder.getUriForMsg(msgHdr);
throw new ExtensionError(`Error reading message ${messageId} - ${uri}`);

In order to see this error, I need to have an Add-on installed.
In my case, it was an older version of the send-later Add-on.
(It's unnecessary to actively use the Add-on.)

Seen with version 128.4.3+ (some patches on top).
I haven't tested with comm-central.

Version: unspecified → Thunderbird 128

I think I do not consider the act of throwing as a bug. The WebExtension gets a proper error (2 being the ID of the message that failed to be read).

Error reading message 2

The add-on should catch the error. We usually do not expose the URL of the failed message, as it exposes internal information about the users server. The extension tried to read message XY and got the error that reading message XY failed.

On comm-central, the behavior is a bit different, because of Bug 1855486, which removes any deleted or moved message from the WebExtension message tracker. The request to read the message no longer fails when trying to read the message, but is aborted at an earlier stage and fails with:

Error: Message not found: 2

I marked ESR128 to be affected by bug 1855486 and will uplift it (if that is possible).

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