如何将自己开发的WebExtension安装到Firefox Nightly?
How do I install WebExtension that developed by myself to Firefox Nightly?
我已经知道临时安装插件调试的方法了。
但是,我想持久安装它。我不想将它上传到 AMO,因为我开发它仅供自己使用。
如何在 Firefox Nightly 上安装它?
浏览器:Firefox Nightly 56a1
OS: macOS 10.12.5
编辑
参考Getting started with firefox-addon,我尝试了安德鲁的方式,但出现错误(This add-on could not be installed because it appears to be corrupt.
),尽管临时安装成功。
为什么只有从 Install Add-on from File...
安装时才安装失败?
源代码在这里
https://github.com/KiYugadgeter/webext
编辑2:
以下是浏览器控制台上的错误消息。
1497764354857 addons.xpi WARN Invalid XPI: Error: Cannot find id for
addon /
Users/username/jsworks/webextensions/stacknotifier/something.xpi (resource://gre/modules/addons/XPIInstall.jsm:1642:17) JS Stack trace: loadManifest@XPIInstall.jsm:1642:17 <
async*init@XPIInstall.jsm:2122:13 < async*createLocalInstall@XPIProvider.jsm:4820:12 < getInstallForFile@XPIProvider.jsm:3437:5 < callProviderAsync@AddonManager.jsm:297:12 <
promiseCallProvider/<@AddonManager.jsm:321:53 < Promise@Promise-backend.js:390:5 <
promiseCallProvider@AddonManager.jsm:320:10 < getInstallForFile/<@AddonManager.jsm:1856:29
< async*getInstallForFile@AddonManager.jsm:1854:13 < getInstallForFile@AddonManager.jsm:
3560:7 < doCommand/<@extensions.js:1472:13
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIURI.hostPort]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/PopupNotifications.jsm :: PopupNotifications_refreshPanel/< :: line 806" data: no]
最新版本的 Firefox 要求您先对扩展进行签名,然后才能永久安装它。要对您的扩展进行签名,您不必发布它。您只需要一个名为 web-ext
的工具。然后你可以从你的终端简单地运行这个:
web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET
web-ext 入门:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext
web-ext sign
:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_sign
得到你的 AMO_JWT_ISSUER 和 AMO_JWT_SECRET:
https://addons.mozilla.org/en-US/developers/addon/api/key/
简而言之:
- Downlaod and Install NodeJS
- 打开一个新终端并运行
npm install --global web-ext
- 前往 api key site 并获取您的 AMO_JWT_ISSUER 和 AMO_JWT_SECRET
打开一个新终端,进入包含您的扩展源和 运行
的文件夹
web-ext sign --api-key=xxxx:xxxxxxx:xxx --api-secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
既然你说你在使用 Nightly,你也可以转到 about:config,找到首选项 "xpinstall.signatures.required" 并将其设置为 false。然后你应该能够从 about:addons -> "Install Add-on from File..."
安装你的扩展
你的错误是:Invalid XPI: Error: Cannot find id for addon
引用 WebExtension documentation:
When do you need an Add-on ID?
- If you are loading the add-on from it's XPI file, are not loading it temporarily using about:debugging and it is not signed.
- ...
这是你的情况;因此,您需要填写 applications.gecko.id
key in the manifest. This plays the similar role as setting key
key in Chrome(在 Chrome 中,打包扩展的 ID 是 key
字段的散列)。
或者(可能最好),您可以按照 的指示对您的 XPI 进行签名,因为加载未签名的 WebExtensions 只能在 Nightly 中进行。这将需要与 AMO 交互 - 但不需要在那里托管。
我已经知道临时安装插件调试的方法了。 但是,我想持久安装它。我不想将它上传到 AMO,因为我开发它仅供自己使用。
如何在 Firefox Nightly 上安装它?
浏览器:Firefox Nightly 56a1
OS: macOS 10.12.5
编辑
参考Getting started with firefox-addon,我尝试了安德鲁的方式,但出现错误(This add-on could not be installed because it appears to be corrupt.
),尽管临时安装成功。
为什么只有从 Install Add-on from File...
安装时才安装失败?
源代码在这里 https://github.com/KiYugadgeter/webext
编辑2:
以下是浏览器控制台上的错误消息。
1497764354857 addons.xpi WARN Invalid XPI: Error: Cannot find id for
addon /
Users/username/jsworks/webextensions/stacknotifier/something.xpi (resource://gre/modules/addons/XPIInstall.jsm:1642:17) JS Stack trace: loadManifest@XPIInstall.jsm:1642:17 <
async*init@XPIInstall.jsm:2122:13 < async*createLocalInstall@XPIProvider.jsm:4820:12 < getInstallForFile@XPIProvider.jsm:3437:5 < callProviderAsync@AddonManager.jsm:297:12 <
promiseCallProvider/<@AddonManager.jsm:321:53 < Promise@Promise-backend.js:390:5 <
promiseCallProvider@AddonManager.jsm:320:10 < getInstallForFile/<@AddonManager.jsm:1856:29
< async*getInstallForFile@AddonManager.jsm:1854:13 < getInstallForFile@AddonManager.jsm:
3560:7 < doCommand/<@extensions.js:1472:13
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIURI.hostPort]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/PopupNotifications.jsm :: PopupNotifications_refreshPanel/< :: line 806" data: no]
最新版本的 Firefox 要求您先对扩展进行签名,然后才能永久安装它。要对您的扩展进行签名,您不必发布它。您只需要一个名为 web-ext
的工具。然后你可以从你的终端简单地运行这个:
web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET
web-ext 入门:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext
web-ext sign
:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_sign
得到你的 AMO_JWT_ISSUER 和 AMO_JWT_SECRET:
https://addons.mozilla.org/en-US/developers/addon/api/key/
简而言之:
- Downlaod and Install NodeJS
- 打开一个新终端并运行
npm install --global web-ext
- 前往 api key site 并获取您的 AMO_JWT_ISSUER 和 AMO_JWT_SECRET
打开一个新终端,进入包含您的扩展源和 运行
的文件夹web-ext sign --api-key=xxxx:xxxxxxx:xxx --api-secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
既然你说你在使用 Nightly,你也可以转到 about:config,找到首选项 "xpinstall.signatures.required" 并将其设置为 false。然后你应该能够从 about:addons -> "Install Add-on from File..."
安装你的扩展你的错误是:Invalid XPI: Error: Cannot find id for addon
引用 WebExtension documentation:
When do you need an Add-on ID?
- If you are loading the add-on from it's XPI file, are not loading it temporarily using about:debugging and it is not signed.
- ...
这是你的情况;因此,您需要填写 applications.gecko.id
key in the manifest. This plays the similar role as setting key
key in Chrome(在 Chrome 中,打包扩展的 ID 是 key
字段的散列)。
或者(可能最好),您可以按照