Modify test_nsIMsgFolderListenerLocal.js to use Promises
Categories
(MailNews Core :: General, defect)
Tracking
(Not tracked)
People
(Reporter: benc, Unassigned)
Details
The test currently works by setting gExpectedEvents
(defined in comm/mailnews/test/resources/msgFolderListenerSetup.js
) to the list of notifications it expects, then running the operation. Asserts trigger if the events don't arrive in the expected order.
The code would be much easier to follow if there was just a local object set up to collect the events, and await was used to pause until the operation is complete.
In particular, the compactFolder()
helper function calls nsIMsgfolder.compact()
without waiting for the compaction to complete.
This makes it very sensitive to where folder notifications are issued. In particular, it fails if the folderCompactStart
is issued after nsIMsgFolder.compact()
returns (and to be properly correct, compact() should not trigger any callbacks until after it returns anyway!)
PromiseTestUtils.PromiseUrlListener
could be used to fix up compactFolder()
, but there'd be some async/await ripple-up I think...
Description
•