Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
535 views
in Technique[技术] by (71.8m points)

dll - Using a plugin generated with Firebreath in a Firefox Extension?

Is it possible to use a .dll made with Firebreath in a Firefox extension?

Currently, I am trying to port an extension I made for Google Chrome that uses javascript to get the HTML of the document, and then calls a function from the .dll and passes the HTML of the document as a parameter. The .dll then saves the file and launches a program.

Is there a simple way to port this functionality over to Firefox? Or will I have to rewrite the code using XPCOM?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

XPCOM is too complicated for simple things which is why Firefox 4 and above has js-ctypes (see https://developer.mozilla.org/en/js-ctypes for an overview and https://developer.mozilla.org/en/js-ctypes/Using_js-ctypes#Calling_Windows_routines for an example). This allows you to load the DLL and call an exported native function easily. If you really need to use this DLL as an NPAPI plugin things get more complicated because you need a window to load the plugin into and Firefox unlike Chrome doesn't have a dedicated background window for that. But I guess that you only turned your DLL into a plugin to be able to use it in Chrome.

On locating your DLL to use with ctypes.open() see my answer here: Reference a binary-component to js-ctypes


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...