5

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
Max Farsikov
  • 2,451
  • 19
  • 25
drtob
  • 333
  • 3
  • 10

1 Answers1

1

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"
    }
},
Paul Heil
  • 295
  • 1
  • 9
  • Thanks for your concern, The "ADDONNAME@test.com" ; is it the name of my addon @ the domain it is hosted or my email(too disturb to add this) or any domain name. BTW, the update_hash; is generated by a program or a concatenation of any character I can think of. Pardon me, I'm still learning – drtob Aug 31 '18 at 07:09
  • In other words, what is "ADDONNAME@test.com" and update_hash as I don't know how to relate with this terms – drtob Aug 31 '18 at 07:36
  • Thanks, I finally breakthrough, it seems the "id" assigned to my previous version is different from the one I'm changing to. I fixed that with some host of other things. I made it. Thanks very much – drtob Sep 01 '18 at 15:09