views:

36

answers:

2

I have a very limited experience with Firefox extensions development (read XUL School, written a couple of very simple extensions).

I now need some functionality that is not available through Firefox XPCOM objects, namely running an external process and reading its stdout. It seems that this can be done using Protozilla. So my problems becomes now to include this external XPCOM object in my XPI so that it will be available to my extension.

I should make clear that my problem is NOT how to build an XPCOM object, since I already have their builds and if I need to change something I already have their makefiles. My problem is: what do I do now? My extensions tree look like

/
-->chrome/
-->-->content
-->-->-->browserOverlay.js
-->-->-->...
-->-->locale
-->-->-->en-US
-->-->-->-->browserOverlay.dtd
-->-->-->-->browserOverlay.properties
-->-->-->...
-->-->skin
-->-->-->...
-->defaults/
-->-->preferences/
-->-->-->my_extension.js
-->modules/
-->-->common.js
-->chrome.manifest
-->install.rdf

Where should I include the XPCOM files? Do I need to do something to tell Firefox that a new XPCOM object is available?

+3  A: 

From Mozilla developer center,

XPCOM Components

Firefox supports XPCOM components in extensions. You can create your own components easily in JavaScript or in C++ (using the Gecko SDK).

Place all of your .js or .dll files in the components/ directory - they are automatically registered the first time Firefox runs after your extension is installed.

https://developer.mozilla.org/en/building_an_extension

Aillyn
A: 

You could use nsIProcess to launch the process, have it write to a known location, and then read from that file using nsIFile.

jeffamaphone
Yes, I have thought about it. But since I have to do this thousand of times (or tens of thousands) I'd like to avoid writing to a file if possible.
Andrea
Well, that is a little scary. What are you doing, more specifically?
jeffamaphone