Open Bug 1848476 Opened 2 years ago Updated 4 months ago

Remove cumbersome nsIMsgLocalMailFolder.checkForNewMessagesAfterParsing mechanism

Categories

(MailNews Core :: Backend, task)

Tracking

(Not tracked)

People

(Reporter: benc, Unassigned)

References

Details

nsMsgLocalMailFolder::GetNewMessages() needs to wait for a folder reparse before running, if the db is missing or out of date.
It does this by setting the .checkForNewMessagesAfterParsing attribute, and relying on the reparse code to check it upon completion and call GetNewMessages() again.

This just complicates the folder-parsing code, which really shouldn't have to deal with it.

Would be much better for GetNewMessages() to pass a UrlListener into GetDatabaseWithReparse(), and kick off the new message check in the OnStopRunningUrl() method of that listener. This can all be done inside GetNewMessages() with a lambda.
Keep the follow-on code near to where the operation is invoked rather than scattered all over the codebase.

Also:

  • .checkForNewMessagesAfterParsing is no longer needed. Should be removed from both the IDL and the implementation. It's never used anywhere else.
  • Should audit GetDatabaseWithReparse() to be really clear on when the listener is or isn't invoked!

But this can wait on Bug 1719121.

You need to log in before you can comment on or make changes to this bug.