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

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

问题描述

我试图在Firefox 45中安装一个扩展(Firefox 49也是如此),但是Firefox不允许我这样做,表示
$ b

 无法安装此附加组件,因为它看起来已损坏。 

我试图安装它的方法很简单,只需拖动.xpi文件<我们的团队开发,进入Firefox窗口。此扩展程序基于



看来我并没有正确地创建.xpi文件,但是我不确定哪个是正确的它应该有的结构。我尝试了不同的文件夹结构,但没有成功。

另外,我查看了浏览器控制台,看看有什么错误登录,但是我没有发现它确实有帮助。这里是:





这里是一个到.xpi文件的链接,以防你想检查它内容。请注意,我尝试将文件manifest.mf,zigbert.rsa和zigbert.sf移到META-INF文件夹外,但它也不起作用。

有没有人当试图安装附加软件时偶然发现了这样的错误?任何想法可能发生什么?

解决方案

.xpi 文件必须仅使用 / em>deflate压缩或解压缩



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

我个人使用批处理文件/ shell脚本来创建 .xpi 文件,正如我在 Firefox扩展.xpi文件结构:描述,内容,创建和安装。基本的是,我使用 zip 命令行工具,默认为deflate或未压缩。我使用 -1 选项来提供最快的压缩。 Firefox / Mozilla使用 .xpi 文件来打包文件,同时也提高文件访问速度。重要的质量不是一个很高的压缩比,而是可以快速访问文件。除非Firefox不是WebExtension,并明确告诉您通过 install.rdf 选项解压附件 > install.rdf文件),附加组件将被安装为 .xpi 文件,并且对附加组件的所有访问将以 .xpi 文件。



注意:由于您的扩展名包含 .dll 文件,因此您可能需要将您的加载项解包为< a href =https://developer.mozilla.org/en-US/Add-ons/Install_Manifests#unpack =nofollow noreferrer> < 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天全站免登陆