Hi,
Getting started in modifying code in mail-news which has UI ramifications, so I'm trying to understand the model by which JS calls through to XPCOM components.
Good for you! most people jump in and then ask questions ;)
It appears that events in the UI are handled using a thread pool, thus allowing multiple events to be handled simultaneously. Is this correct?
No. All JS events are handled on the main (UI) thread. However, we have a policy that you may not call an XPCOM method from the UI thread which might block on network activity, etc. So the networking layer uses helper threads which perform the actual networking activity. These threads proxy progress notifications back to the main thread.
If I am going to create a long running event in response to UI action (e.g. causing a message to be downloaded from IMAP if not in the cache), can I do it in the message handler (e.g. nsIMessenger::SaveAllAttachments) or should I definitely spawn the task into the url listener style of callbacks (e.g. what SaveAllAttachments currently does).
You should definitely move direct network calls off the main thread. Try posting to npm.netlib (I have cc'ed this post) to figure out whether there is code in the networking library that does this automatically, or whether you need to manually setup a worker thread.
--BDS _______________________________________________ Mozilla-netlib mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-netlib