As suggested by Hartmut here https://phabricator.services.mozilla.com/D267518#9249473 reversing the calls (and just doing UpdateFolder() w/o the listener) seems to work for me. However, if I add a simple printf after the calls, it fails again, usually. If I remove the printf it seems OK for the messages I've tried to filter after sending.
Bug 2008314 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
As suggested by Hartmut here https://phabricator.services.mozilla.com/D267518#9249473 reversing the calls (and just doing UpdateFolder() w/o the listener) seems to work for me. However, if I add a simple printf after the calls, it fails again, usually. If I then again remove the printf it seems OK for the messages I've tried to filter after sending.