Open Bug 1892531 Opened 5 months ago Updated 5 months ago

nsIMsgFolder.createSubfolder() should take a listener parameter

Categories

(MailNews Core :: General, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: benc, Unassigned)

References

(Blocks 1 open bug)

Details

nsIMsgFolder.createSubfolder() is essentially an async function - there might be a round trip to a server involved. And currently there's no way to for it to pass the eventually-created folder back to the caller.

Also, if the operation fails, the caller will never know. It has a window parameter, which I think implies that it'll show an error message directly to the user. It should really communicate the error back to the caller instead, and let the caller deal with it.

I think it's probably synchronous for local folders (and probably does return an error message), but since it is async for IMAP it should be consistently async!

I'd recommend:

  1. removing the window parameter altogether, and make callers responsible for error handling.
  2. then either returning a nice JS-friendly promise to make it proper async in the JS sense, or adding a listener parameter that is capable of passing back a folder and error code.

Bug 1367034 might benefit from this (eg adding newly-created folders to the "recent folders" list)

See Also: → 1367034
Blocks: 1367034
See Also: 1367034
You need to log in before you can comment on or make changes to this bug.