从外部应用程序启用/禁用 Firefox 插件

发布于 2024-12-26 07:11:24 字数 141 浏览 1 评论 0原文

是否可以从外部应用程序启用/禁用 Firefox 插件,最好不使用任何 XPCOM 组件? 我的第一个想法是使用直接修改 [profile dir]/extensions.sqlite 的控制台应用程序,但这似乎不太有效。 这可能吗?

Is is possible to enable/disable firefox addons from an external application, preferably without using any XPCOM components?
My first thought was to use a console app that modified [profile dir]/extensions.sqlite directly, but this doesn't quite seem to work.
Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木森分化 2025-01-02 07:11:24

那么您想操纵用户安装的附加组件吗?以不受支持的方式操作配置文件数据通常是一个坏主意 - 您必须对格式做出大量假设,并且如果格式发生更改(或发生其他您意想不到的情况),则可能会造成破坏。最接近支持的操作是在 /extensions 目录中添加/删除扩展。从 Firefox 4 开始,扩展将有目录(目录名称是扩展 ID)或打包的 XPI 文件(文件名称是 .xpi)。如果从此目录中删除扩展,所有必要的卸载操作都会自动发生。如果添加了扩展,它通常会自动安装。从 Firefox 8 开始,系统将询问用户是否允许安装该附加组件 - 用户需要确认。

当然,所有这些操作都假设 Firefox 没有运行。在 Firefox 运行时操作配置文件是危险的,因为某些文件可能被锁定,而其他文件可能稍后在浏览会话中需要,如果丢失/更改,则会导致损坏。

So you want to manipulate user-installed add-ons? Manipulating profile data in an unsupported way is generally a bad idea - you have to make lots of assumptions about the format and risk breaking things if that format changes (or something else happens that you didn't expect). The closest thing to a supported manipulation would be adding/removing extensions in the <profile>/extensions directory. As of Firefox 4 the extensions there will either be directories (directory name is the extension ID) or packed XPI files (file name is <extensionID>.xpi). If an extension is removed from this directory all the necessary uninstall actions will happen automatically. If an extension is added it used to be installed automatically. As of Firefox 8 the user will be asked whether the installation of the add-on should be allowed - and the user needs to confirm it.

Of course all these manipulations assume that Firefox isn't running. Manipulating the profile while Firefox is running is dangerous because some files might be locked, others might be required later in the browsing session and cause breakage if they are missing/changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文