How to update self-hosted firefox webExtension

3

How do I configure my self-distrubuted firefox webExtension to auto-update, I have tried following MDN update doc but still unable to update. My web Extension is hosted on a sub-domain name like

"https://files.example.com/myfile/extension.xpi"

My updates.json file resides at the same location with my .xpi file

This is a prototype of my updates.json

{
  "addons": {
      "updates": [ { "version": "1.2",
          "update_link": "https://files.abc.com/myfiles/extension-1.2-an+fx.xpi" },
           { "version": "1.3",
          "update_link": "https://files.abc.com/myfiles/extension-1.3-an+fx.xpi" }
      ]
  }
}

This is the gibberish I get from browser console

1535658478365 addons.update-checker WARN onUpdateCheckComplete failed 
to parse update manifest: [Exception... "Update manifest is missing a 
required addons property." nsresult: "0x80004005 (NS_ERROR_FAILURE)" 
location: "JS frame :: 
resource://gre/modules/addons/AddonUpdateChecker.jsm :: 
getRequiredProperty :: line 120" data: no] Stack trace: 
getRequiredProperty()@resource://gre/modules/addons/AddonUpdateChecker.jsm:120
parseJSONManifest()@resource://gre/modules/addons/AddonUpdateChecker.jsm:130 onLoad()@resource://gre/modules/addons/AddonUpdateChecker.jsm:309 UpdateParser/<()@resource://gre/modules/addons/AddonUpdateChecker.jsm:241
firefox
firefox-webextensions
asked on Stack Overflow Aug 30, 2018 by drtob • edited Aug 31, 2018 by Max Farsikov

1 Answer

0

It looks like your 'updates.json' is missing the add-on name and XPI hash. I would also test without the "+" in the file name, I think that caused me issues (Due to hosting server).

To view your add-ons UUID (ex "ADDONNAME@test.com") log into the developer hub, click edit information, then look under technical information. To generate an update_hash of your XPI file I would recommend VSCryptoHash, but any other program that generates a cryptographic hash will work.

{
  "addons": {
    "ADDONNAME@test.com": {
      "updates": [
       { "version": "1.0.0",
         "update_link": "https://files.abc.com/myfiles/extension-1.2-fx.xpi" ,
         "update_hash": "sha256:blahblah" }
      ]
    }
  }
}

The console error says your manifest is missing something too. Here is an example based on mine that works.

"applications": {
    "gecko": {
        "id": "ADDONNAME@test.com",
        "strict_min_version": "50.0",
        "update_url": "https://webpage/Updatefile.json"
    }
},
answered on Stack Overflow Aug 31, 2018 by Paul Heil • edited Aug 31, 2018 by Paul Heil

User contributions licensed under CC BY-SA 3.0