1

I'm trying to develop an extension to run on the FirefoxDeveloperEdition (which doesn't require signing) on mac.

I followed the "Your first WebExtension" guide and everything works fine when using the "Load temporary add-on". But when I try to package it and install it using the "install add-on from file", it shows "this add-on could not be installed because it appears to be corrupt". enter image description here

I zip all the files (borderify.js, manifest.json, icons, without the container folder) and change the suffix to .xpi. Is this the correct way of packaging? some answers mention that there should be a "install.rdf" ?, if so, how can I create that file? it seems there is no guide on the docs.

UPDATE:

I've tried using the mac builtin "compress n items", xpi file, also tried using web-ext build, xpi file. they all end up with the same error alert.

UPDATE 2:

I've set xpinstall.signatures.required false in about:config.

My firefox version is: 51.0a2 (2016-10-17) (64-bit)

Is there anyone able to load the unsigned xpi? Is it a Firefox bug? or is it just me?

Keoros
  • 1,337
  • 2
  • 13
  • 23
  • How, *exactly*, are you creating the *.zip* file? – Makyen Oct 17 '16 at 10:34
  • Possibly related: [Add-on “appears to be corrupt” when trying to install my add-on's .xpi file in Firefox](http://stackoverflow.com/q/39854127/3773011). – Makyen Oct 17 '16 at 10:37
  • Without your *.xpi* file, there is no way for us to answer this other than **guessing** at what the problem might be. – Makyen Oct 17 '16 at 10:39
  • I've updated the question with the xpi file links. – Keoros Oct 17 '16 at 11:54
  • Try going to `about:debugging` then click on "load temporary addon" and load this xpi. – Noitidart Oct 17 '16 at 21:09
  • @Noitidart using "load temporary add-on" to load the xpi works, but it will be removed after restarting Firefox. – Keoros Oct 17 '16 at 23:26
  • Did you actually disable signing? Developer Edition lets you disable it but it is enabled by default. Go to `about:config`, find `xpinstall.signatures.required`, and set it to false. – Andrew Swan Oct 18 '16 at 03:46
  • @keoros if you want to do development, you have to enable developer preferences, this will disable signing. Here is an addon the helps with that - https://addons.mozilla.org/en-US/firefox/addon/devprefs/ – Noitidart Oct 18 '16 at 17:23

1 Answers1

10

If you want to install .xpi, you need to provide an id. Add this to your manifest.json root

"applications": {
  "gecko": {
    "id": "borderify@mozilla.org",
  }
}

It's not particularly well documented, specifically this page tells that "add-on will be assigned a randomly-generated temporary ID when you install it in Firefox.". However, that only seems to work for installing over about:debugging - xpi installation still requires an ID. It might be any string, since you've running it on DevEdition with disabled checks anyway.

Goes without saying, that would not work on release Firefox.

P.S: Ctrl-Shift-J will open a browser console that will usually contain additional information about the extension installation error - might be useful next time.

Anatoly Sazanov
  • 1,814
  • 2
  • 14
  • 24
  • Where is this documented? I can't find anything about this. I' trying to write a tiny add-on that just changes some CSS and I can't get it to work, which is ridiculous. – panzi Jan 02 '22 at 23:06
  • 1
    Using Ctrl-Shift-J to open a browser console was very useful for me, because it shows clearly that my .xpi did not load due to a missing localization messages.json file. – tst Dec 05 '22 at 17:09