opto / Expression-Search-NG

update of Thunderbird addon ExpressionSearch/Gmail UI for TB 78 and later
61 stars 8 forks source link

Exception frequently when I delete a message #113

Open jikamens opened 7 months ago

jikamens commented 7 months ago

Getting this exception frequently when I delete a message:

09:28:14.953 TypeError: aState is null 2 ExpressionSearchFilter.jsm:803:5 postFilterProcess resource://expressionsearch/modules/ExpressionSearchFilter.jsm:803 onMessagesChanged chrome://cardbook/content/ovl_cardbookAbout3Pane.js:418 onMessageCountsChanged chrome://messenger/content/mailCommon.js:1136 _messageCountsChanged resource:///modules/DBViewWrapper.jsm:1399 _notifyHelper resource:///modules/DBViewWrapper.jsm:196 onFolderIntPropertyChanged resource:///modules/DBViewWrapper.jsm:248 cmd_deleteMessage chrome://messenger/content/mailCommon.js:299 doCommand chrome://messenger/content/mailCommon.js:729

chrome://messenger/content/about3Pane.js:6620 doCommand chrome://messenger/content/mailCommon.js:729 goDoCommand chrome://messenger/content/globalOverlay.js:99 oncommand chrome://messenger/content/messenger.xhtml:1 When this exception happens the message list doesn't update properly; some of the list doesn't redraw like it should so the messages displayed on most lines in the list are not the actual messages located at those positions in the folder. Version 4.0.28 of the add-on.
Frank071 commented 6 months ago

Still exists in 4.0.34, narrowed it down to postFilterProcess. In quickFilterBar.js, specifically onMessageChange this happens:

let preState = filterDef.name in this.filterer.filterValues ? this.filterer.filterValues[filterDef.name] : null;`
let [newState, update, treatAsUserAction] = filterDef.postFilterProcess(preState,gViewWrapper,filtering);

so preState can explicitly be set to null, but postFilterProcess does not check for aState being null:

postFilterProcess: function (aState, aViewWrapper, aFiltering) {
    this.lastSearchvalue = aState.text;

well... it does, but too late in the code. I changed my version of the extension to first check if aState not equals null and that seems to solve the issue. Not sure how to suggest this code change to @opto