附加组件“似乎已损坏"尝试在 Firefox 中安装我的附加组件的 .xpi 文件时 [英] Add-on "appears to be corrupt" when trying to install my add-on's .xpi file in Firefox

查看:107
本文介绍了附加组件“似乎已损坏"尝试在 Firefox 中安装我的附加组件的 .xpi 文件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Firefox 45 中安装扩展(Firefox 49 也是如此),但 Firefox 不允许我这样做,这表明

无法安装此附加组件,因为它似乎已损坏.

我尝试安装它的方式很简单,就是将我们团队开发的 .xpi 文件拖拽到 Firefox 窗口中.此扩展基于

似乎我没有正确创建 .xpi 文件,但我不确定它应该具有哪个正确的结构.我尝试了不同的文件夹结构,但没有成功.

此外,我检查了浏览器控制台以查看登录的错误,但我没有发现它真的很有帮助.这是:

这里是 .xpi 文件的链接如果您想检查其内容.请注意,我尝试将文件 manifest.mf、zigbert.rsa 和 zigbert.sf 移到 META-INF 文件夹之外,但也没有奏效.

有没有人在尝试安装附加组件时遇到过这样的错误?对可能发生的事情有任何想法吗?

解决方案

.xpi 文件必须onlydeflate"压缩或未压缩

Firefox 中的 zip 实现仅支持 未压缩的文件或使用Deflate"算法压缩的文件.您需要使用压缩方法Deflate"而不是您当前使用的LZMA"来创建 .zip 存档.如何做到这一点取决于您用来创建档案的工具.

就我个人而言,我使用批处理文件/shell 脚本来创建 .xpi 文件,正如我在对Firefox 扩展 .xpi 文件结构:描述、内容、创建和安装".基础是我使用 zip 命令行工具,它默认为放气"或未压缩.我使用 -1 选项来提供最快的压缩.Firefox/Mozilla 使用 .xpi 文件既可以打包文件,也可以提高文件访问速度.重要的质量不是高压缩率,而是可以快速访问文件.除非 Firefox 不是 WebExtension 并且通过 install.rdf 选项明确告知要解压附加组件 true(WebExtensions 没有 install.rdf 文件),附加组件将作为 .xpi 文件安装,并且对附加组件的所有访问都将作为 .xpi 文件.

注意:鉴于您的扩展包含 .dll 文件,您可能需要使用 <em:unpack>true</em:unpack>.

使用了错误的签名方法.它必须由 Mozilla 签名,而不是您自己.

虽然这不是您当前看到的错误,但只要您解决了 .xpi 格式的问题,您就会遇到扩展程序被错误签名的问题.您使用自己的签名签署了扩展程序.它没有由 Mozilla 签署.这是行不通的.它必须由 Mozilla 签名,而不是你自己.你提到你遵循了 MDN 页面中的指示 签署 XPI.但是,正如该页面顶部明确指出的那样,该页面上的说明已过时且不再有效.您应该按照注释中的链接转到页面 签署和分发您的附加组件.页面顶部的注释指出:

<块引用>

注意:这些说明已过时.要在 Firefox 中使用扩展程序,它必须由 Mozilla 签名,而不是由您自己签名.请参阅签署和分发您的附加组件.[强调]

在 Stack Overflow 上还有各种各样的问题来解决签名问题.

I am trying to install an extension in Firefox 45 (same happens with Firefox 49), but Firefox does not allow me to do that, indicating that

This add-on could not be installed because it appears to be corrupt. 

The way I am trying to install it is simply by dragging the .xpi file our team developed, into the Firefox window. This extension is based on MozRepl, but with some improvements.

Previously, I tried to install it but I couldn't as it was not signed (extensions in Firefox versions from 43 onwards require signing). I followed every step in order to sign it, according to this post: Signing a XPI. I am almost certain I could sign it correctly, but now the error Firefox displays is different: "This add-on could not be installed because it appears to be corrupt."

It seems that I am not creating the .xpi file correctly, but I am not sure which is the correct structure it should have. I tried different folder structures, but with no success.

Also, I checked the Browser Console to see what error is logged in, but I didn't found it really helpful. Here it is:

Here is a link to the .xpi file in case you want to check its content. Note that I tried moving the files manifest.mf, zigbert.rsa and zigbert.sf outside the META-INF folder, but it didn't work either.

Has anyone stumbled across an error like this when trying to install an add-on? Any ideas of what maybe happening?

解决方案

The .xpi file must use only "deflate" compression or uncompressed

The zip implementation within Firefox only supports uncompressed files or files compressed with the "Deflate" algorithm. You will need to create the .zip archive using the compression method "Deflate" instead of the "LZMA" which you are currently using. How to do so will depend on the tools you use to create your archive.

Personally, I use a batch file/shell script to create the .xpi file as I describe in detail in my answer to "Firefox extension .xpi file structure: description, contents, creation, and installation". The basics are that I use the zip command line tool which defaults to "deflate" or uncompressed. I use the -1 option to provide the fastest compression. Firefox/Mozilla use .xpi files both to package the files, but to also increase file access speed. The important quality is not a high compression ratio, but that the files can be accessed quickly. Unless Firefox is not an WebExtension and explicitly told to unpack the add-on by the install.rdf option <em:unpack>true</em:unpack> (WebExtensions don't have install.rdf files), the add-on will be installed as the .xpi file and all access to the add-on will be as the .xpi file.

Note: Given that your extension contains .dll files, you may need to have your add-on installed unpacked by using <em:unpack>true</em:unpack>.

Wrong signing method used. It must be signed by Mozilla, not yourself.

While it is not the error you are currently seeing, as soon as you fix the problem with your .xpi format, you will encounter an issue with your extension being signed by the wrong signature. You signed your extension with your own signature. It was not signed by Mozilla. This will not work. It must be signed by Mozilla, not yourself.You mentioned that you followed the directions in the MDN page Signing an XPI. However, as is clearly stated at the top of that page, the directions on that page are outdated and no longer work. You should have followed the link in the note to the page Signing and distributing your add-on. The note at the top of the page states:

Note: These instructions are outdated. For an extension to work in Firefox it must be signed by Mozilla, not by yourself. See Signing and distributing your add-on. [Emphasis added]

There are also a variety of questions here on Stack Overflow which address the signing issue.

这篇关于附加组件“似乎已损坏"尝试在 Firefox 中安装我的附加组件的 .xpi 文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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