tags:

views:

392

answers:

3

I'm about to take on a project that requires a Firefox addon to issue call to COM dll's installed on the client Windows machine and I'm having a hard time estimating the complexity of this undertaking.

I have quite a bit of experience with COM, so I'm not frightened by it. I have less experience with Firefox addons, but I don't think that's where my problems are going to be.

Has anybody done anything like that?

Does Firefox allow its addons to communicate freely with the outside world?

Is there a plugin or sample code somewhere that does something like this (Google turned up little useful results)?

Update: Naturally, I would prefer a solution that doesn't require building an extension in C++, if that's at all possible.

+2  A: 

Create an XPCOM in C++ to talk to your COM objects as usual. The XPCOM extensions can then be made available to Javascript to do the rest of the extension (GUI mainly, I guess). However, that's about all I understand about it :-)

Jasper Bekkers
+2  A: 

You might be interested by IE Tab extension, which is open source. I haven't looked but I guess it does Com access to use IE's display.

PhiLho
A: 

If you do this you'll almost certainly need to use XPCOM. Take a look at Shanti Rao's JSDB, which supports COM/ActiveX within Javascript. The ActiveX stuff is in a file called wrap_com.cpp. It supports most IDispatch interfaces; the Invoke method of IDispatch is the magic that makes this work.

How complex this is depends on how "easy" you want this to be from Javascript. If you implemented an XPCOM thing called IDispatchObject where you had to pass in the names of methods & an array of arguments, then it's probably not too hard. If you want to create a general method for doing dynamic bindings to COM objects & referring to them directly, then that's tougher... not sure if the techniques used in JSDB will carry over to XPCOM.

Jason S