wshanks / tbkeys

Custom keybindings for Thunderbird
Other
190 stars 13 forks source link

`func:MsgSortThreaded` results in `TypeError: win[cmdBody] is not a function` #161

Open duckdalbe opened 10 months ago

duckdalbe commented 10 months ago

I'm trying to set two keybindings: one to show messages threaded, and one to show them unthreaded but grouped by sort. In previous versions of Thunderbird and tbkeys-lite (some while back), this worked with func:MsgSortThreaded and func:MsgGroupBySort, respectively.

With Thunderbird 115.2.3 and tbkeys-lite 2.2.4 on MacOS 14.1 ("Sonoma"), if I add a keybinding with each of those "simple functions", typing that key results in Thunderbird's default action for that key and this exception in the Error Console:

Uncaught TypeError: win[cmdBody] is not a function
    callback jar:file:///Users/x/Library/Thunderbird/Profiles/bbxmg1ib.default-release/extensions/tbkeys-lite@addons.thunderbird.net.xpi!/implementation.js:115
    _fireCallback jar:file:///Users/x/Library/Thunderbird/Profiles/bbxmg1ib.default-release/extensions/tbkeys-lite@addons.thunderbird.net.xpi!/modules/mousetrap.js:616
    _handleKey jar:file:///Users/x/Library/Thunderbird/Profiles/bbxmg1ib.default-release/extensions/tbkeys-lite@addons.thunderbird.net.xpi!/modules/mousetrap.js:677
    handleKey jar:file:///Users/x/Library/Thunderbird/Profiles/bbxmg1ib.default-release/extensions/tbkeys-lite@addons.thunderbird.net.xpi!/modules/mousetrap.js:1008
    _handleKeyEvent jar:file:///Users/x/Library/Thunderbird/Profiles/bbxmg1ib.default-release/extensions/tbkeys-lite@addons.thunderbird.net.xpi!/modules/mousetrap.js:737

These functions are listed at http://kb.mozillazine.org/Keyconfig_extension:_Thunderbird and are still available in comm-central, so I'm wondering what's wrong.

Anyone got a hint how to solve this?

morat523035 commented 10 months ago

Thunderbird 102:

window.MsgSortThreaded();
window.MsgGroupBySort();

Thunderbird 115:

window.gTabmail.currentAbout3Pane.sortController.sortThreaded();
window.gTabmail.currentAbout3Pane.sortController.groupBySort();

Or

window.goDoCommand('cmd_sort', {target:{value:'threaded'}});
window.goDoCommand('cmd_sort', {target:{value:'group'}});

Reference (see handleCommand) http://searchfox.org/comm-esr115/source/mail/base/content/about3Pane.js

Reference (see cmd_sort) http://searchfox.org/comm-esr115/source/mail/base/content/about3Pane.xhtml

You cannot run arbitrary javascript with tbkeys-lite. There is a tbkeys.xpi link on the GitHub releases page.

duckdalbe commented 9 months ago

Thank you very much for the hints! I'll see if I'll switch to not-lite for this.

This issue could probably be closed (unless someone else has another suggestion?).