nsIMsgFolder.subFolder implementations shouldn't create folders lazily.
Categories
(MailNews Core :: Backend, defect)
Tracking
(Not tracked)
People
(Reporter: benc, Unassigned)
References
Details
Currently, implementations of the nsIMsgFolder.subFolder
perform lazy folder creation. This complicates things, and leads to oddities like in Bug 1629204, where folders are created during shutdown :-)
I think it'd be much clearer if folder creation was handled explicitly and nsIMsgFolder.subFolder
just returned the currently-known subfolders, without the side effects.
I'd guess that the time to do deliberate folder creation is during nsIMsgIncomingServer initialisation. For some types (eg IMAP), this initial set of folders is provisional, pending receipt of the definitive list from a remote server.
Currently, the base implementation, nsMsgDBFolder::GetSubFolders()
, just returns whatever subfolders already exist. No side effects.
The derived implementations:
nsImapMailFolder::GetSubFolders()
nsMsgLocalMailFolder::GetSubFolders()
nsMsgNewsFolder::GetSubFolders()
All perform folder discovery (latched behind internal mInitialized
flags).
For example, the nsMsgLocalMailFolder
implementation scans the local filesystem (via the plugable mail store) to create folders.
IMAP can immediately set up folders by scanning the filesystem and foldercache, but the definitive list of folders will eventually be synced with the remote server.
I didn't see any javascript implementations of nsIMsgFolder
, but I might have missed something.
Updated•4 years ago
|
Description
•