使用Firefox Addon SDK在后台嵌入NPAPI插件 [英] Embedding NPAPI plugin in background using just Firefox Addon SDK

查看:153
本文介绍了使用Firefox Addon SDK在后台嵌入NPAPI插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开发了一个NPAPI插件(使用FireBreath)和Google Chrome扩展。我使用 background.html 页面嵌入插件,并从多个扩展页面访问它。因此,该插件仍然在后台页面加载(直到扩展被卸载或浏览器被关闭)。

我现在正在寻找最简单的方式来移植此扩展到Firefox。使用Addon SDK及其API,我可以重现插件代码和HTML用户界面之间的通信。



由于没有像Chrome扩展那样的全局背景DOM ,我将如何加载NPAPI插件一次,而不是插入应用程序用户界面的每一页?



我已经看到,使用将允许 - 有没有一种方法只使用XUL覆盖addon sdk?






编辑:我已经用最小的使用page-workers解决这个问题。

解决方案

您需要查看页面worker模块:



https://addons.mozilla.org/en-US/developers/docs/sdk/1.8/ package / addon-kit / page-worker.html



我想给出的是NPAPI插件可能会对可见性或其他细节做出假设它所运行的环境根本不适用于页面工作环境。如果遇到错误,我很乐意听到他们的声音!


I have recently developed a NPAPI plugin (using FireBreath) in combination with a Google Chrome Extension. I am embedding the plugin using the background.html page and access it from multiple extension pages. Thus, the plugin remains loaded in the background page (until the extension is unloaded or the browser is closed).

I am now searching for the easiest way to port this extension to Firefox. Using the Addon SDK and it's API, i can reproduce the communication between the addon code and HTML user interface.

As there is no such global background DOM as in the Chrome Extension, how would I load the NPAPI plugin just once, without inserting it in every page of the app UI?

I've seen that using a XUL overlay would allow that - is there a way using just the addon sdk?


Edit: I've created an answer to this question with a minimal solution to this problem using page-workers.

解决方案

You'll want to look at the page-worker module:

https://addons.mozilla.org/en-US/developers/docs/sdk/1.8/packages/addon-kit/page-worker.html

The caveat I would give is that the NPAPI plugin might have made assumptions about visibility or other details of the environment it is running in that simply don't apply in the page-worker environment. If you run into errors, I'd be interested to hear them!

这篇关于使用Firefox Addon SDK在后台嵌入NPAPI插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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