在Firefox扩展中使用Firebreath生成的插件? [英] Using a plugin generated with Firebreath in a Firefox Extension?

查看:179
本文介绍了在Firefox扩展中使用Firebreath生成的插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Firefox扩展程序中使用Firebreath制作的.dll?

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

目前,我正在尝试移动我为谷歌浏览器制作的扩展,使用javascript获取文档的HTML,然后调用.dll和将文档的HTML作为参数传递。 .dll然后保存文件并启动程序。

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.

有没有一种简单的方法将此功能移植到Firefox?或者我必须使用XPCOM重写代码?

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

推荐答案

XPCOM对于简单的东西来说太复杂,这就是为什么Firefox 4及以上有js-ctypes(请参阅 https://developer.mozilla.org/en/js-ctypes 进行概述和 https://developer.mozilla.org / en / js-ctypes / Using_js-ctypes#Calling_Windows_routines 为例)。这允许您加载DLL并轻松调用导出的本地函数。如果你真的需要使用这个DLL作为NPAPI插件,事情会变得更加复杂,因为你需要一个窗口来加载插件和Firefox,而Chrome没有专门的后台窗口。但是我猜你只是将你的DLL转换成一个插件,以便能够在Chrome中使用它。

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.

在找到要用于ctypes.open()的DLL时看到我的在这里回答:将二进制组件引用到js -ctypes

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

这篇关于在Firefox扩展中使用Firebreath生成的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆