Hi, I'm currently writing a toolbar that connects Firefox to our native application (long story for a different day). I have a chain that looks like this: Javascript <-> C++ (XPCOM) <-> ActiveX <-> Our App.
When connecting to our native app from Javascript, I invoke a method on an XPCOM component which in turn responds with an event such as "connected". The event is dispatched to javascript through observers. This scenario works fine, as long as I stick to firing events in the calling thread. However, our native app continuously and asynchronously delivers events that needs to be dispatched to javascript for processing in the browser. This is where it fails; when fireing events in the calling thread of a JS-invokation, it works; when firing events from an arbitrary thread the "NotifyObservers"-method hangs, probably because the script hangs. I haven't been able to find a definitive pattern for when the method hangs, but the combination "arbitrary thread + alert()" seems to do the trick, as well as calling other UI-related functions. Are there any rules in particular that pertains to threading in XPCOM or to Firefox extensions? I've looked around, but can see any clear definitions as one does in e.g. Microsoft COM. Any idea why it hangs? Regards, Nille PS I posted another topic here: http://groups.google.com/group/mozilla.dev.extensions/browse_thread/thread/c269b486b11ad7a4 In retrospect, this group seems more suitable. DS _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
