messenger.messages.getRaw: An unexpected error occurred / msgHdr is null on modified draft message
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(Not tracked)
People
(Reporter: dominik.hoelzl, Unassigned)
Details
Attachments
(1 file)
|
2.37 KB,
application/x-zip-compressed
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Steps to reproduce:
WebExtension: messenger.messages.getRaw throws exception: An unexpected error occurred / msgHdr is null when called on a draft message which was modified / saved.
Reproduction:
- Extract the attached reproduction extension zip file
- Open Tools -> Developer Tools -> Debug Add-ons; Load Temporary Add-on... -> Select the extracted manifest.json
- Click on "Inspect" on the extension, switch to console to later see the exception
- Write a new draft message (e.g. with a simple subject and text)
- Right-click on the newly created message - the extension will create a menu entry "GetRaw Exception Reproduction"
- Click on "GetRaw Exception Reproduction", this calls messenger.messages.getRaw on the selected message, a dialog with the message "getRaw succeeded, length: <length of EML string>" should be displayed, close the dialog
- Modify the draft message: Double click, optionally change subject/text and save it (Ctrl+S or File -> Save), close the message window. The problem can be reproduced with just saving the message, a modification is not necessarily required.
- Right-click and click on "GetRawException Reproduction" again, a dialog with the message "Error: An unexpected error occurred" should be displayed.
- In the console of the extension inspection tab, the following exceptions are shown:
msgHdr is null ext-messages.js:218
getRaw chrome://messenger/content/parent/ext-messages.js:218
getRaw self-hosted:935
result resource://gre/modules/ExtensionParent.jsm:930
withPendingBrowser resource://gre/modules/ExtensionParent.jsm:485
result resource://gre/modules/ExtensionParent.jsm:930
callAndLog resource://gre/modules/ExtensionParent.jsm:892
recvAPICall resource://gre/modules/ExtensionParent.jsm:929
AsyncFunctionNext self-hosted:684
Error: An unexpected error occurred
messenger.messages.getRaw will now always fail on the saved draft message and continues to work on other messages.
When restarting Thunderbird, it will work again on all messages including the previously failed; Saving a message again, and the exception appears again.
When writing a new draft, the message can be saved arbitrary times. The problem does not occur until the message window was closed, re-opened and the saved at least once.
I could reproduce the problem with Thunderbird 78.3.1 and 79.0b3, I have not tested other versions.
Expected results:
Expected behavior: messenger.messages.getRaw should always succeed, regardless if a message was saved or not.
Comment 1•5 years ago
|
||
I was able to reproduce this and the problem is that the underlying messageId remains the same but with each save, the messageKey changes and when the extensions queries the underlying DB it seems like it can't find the messageKey asociated to that messageId.
This line returns null so the underlying problem should be somewhere around here https://searchfox.org/comm-central/source/mailnews/db/msgdb/src/nsMsgDatabase.cpp#4087-4127
Updated•5 years ago
|
Description
•