9

I already know the way to temporarily install an add-on for debugging. However, I want to install it persistently. I do not want to upload it to AMO, because I've developed it for use by myself only.

How do I install it on Firefox Nightly?

Browser: Firefox Nightly 56a1
OS: macOS 10.12.5

Edit

I attempted Andrew's way while referring to Getting started with firefox-addon, but an error occurred (This add-on could not be installed because it appears to be corrupt.), despite that temporary installation was successful.
Why did installation fail only when installing it from Install Add-on from File...?

Source code is here https://github.com/KiYugadgeter/webext

Edit2:

The following is Error message on browser console.

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]
Makyen
  • 31,849
  • 12
  • 86
  • 121
KiYugadgeter
  • 3,796
  • 7
  • 34
  • 74
  • 1
    See: [Installing add-ons for development](https://stackoverflow.com/documentation/firefox-addon/3235/getting-started-with-firefox-addon/27246/installing-add-ons-for-development) in documentation. – Makyen Jun 14 '17 at 17:49
  • 1
    The quoted error is "Cannot find id for addon" - do you have one set in the manifest? – Xan Jun 19 '17 at 11:39

3 Answers3

10

Recent versions of Firefox require you to sign the extension before you can permanently install it. To get your extension signed you don't have to publish it. All you need is a tool called web-ext. Then you can simply run this from your terminal:

web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET

Getting started with 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

Getting your AMO_JWT_ISSUER and AMO_JWT_SECRET:
https://addons.mozilla.org/en-US/developers/addon/api/key/

In short:

  • Downlaod and Install NodeJS
  • Open a new terminal and run npm install --global web-ext
  • Go to api key site and get your AMO_JWT_ISSUER and AMO_JWT_SECRET
  • Open a new terminal, go into the folder which contains your extension sources and run

    web-ext sign --api-key=xxxx:xxxxxxx:xxx --api-secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
Forivin
  • 14,780
  • 27
  • 106
  • 199
9

Your error is: Invalid XPI: Error: Cannot find id for addon

Quoting 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.
  • ...

This is your situation; as such, you need to fill out the applications.gecko.id key in the manifest. This plays the similar role as setting key key in Chrome (in Chrome, the ID of a packed extension is a hash of the key field).

Alternatively (and possibly preferably), you can sign your XPI as indicated by Forivin's answer, because loading unsigned WebExtensions is only possible in Nightly. That would require interaction with AMO - but there's no requirement to host there.

Xan
  • 74,770
  • 16
  • 179
  • 206
2

Since you said you're using Nightly, you can also go to about:config, find the preference "xpinstall.signatures.required" and flip it to false. Then you should be able to install your extension from about:addons -> "Install Add-on from File..."

Andrew Swan
  • 1,268
  • 6
  • 7
  • I tried this way but it occured a error (`This add-on could not be installed because it appears to be corrupt.`)despite temporary installation be successful. – KiYugadgeter Jun 16 '17 at 05:28
  • Did you generate the xpi with web-ext or manually? Is there anything in the browser console (not the regular web console)? – Andrew Swan Jun 17 '17 at 20:31
  • @KiYugadgeter Does it even work if you install it from `about:debugging`? To me this sound like your addon is actually corrupt. – Forivin Jun 19 '17 at 13:18
  • 2
    my extension works when it installed from `about:debugging`. (`about:debugging` use for only temporary installation) – KiYugadgeter Jun 20 '17 at 12:59