Update is not working for webextension

Hello

I have a webextension that is signed and self hosted. My problem is that the update is not working. I activated the extension logging and then I see in the browser console this messages:

1505316003521 addons.webextension. WARN Loading extension ‘null’: Reading manifest: Error processing background.persistent: Event pages are not currently supported. This will run as a persistent background page.
1505316003527 addons.webextension. WARN Loading extension ‘null’: Reading manifest: Error processing permissions.3: Value “unlimitedStorage” must either: must either [be one of [“clipboardRead”, “clipboardWrite”, “geolocation”, “idle”, “notifications”], must either [be one of ["<all_urls>"], match the pattern /^(https?|wss?|file|ftp|*)://(*|*.[^/]+|[^/]+)/.$/, or match the pattern /^file:///.$/], be one of [“bookmarks”], be one of [“history”], be one of [“activeTab”, “tabs”], be one of [“cookies”], be one of [“topSites”], be one of [“webNavigation”], or be one of [“webRequest”, “webRequestBlocking”]], be one of [“alarms”, “storage”], be one of [“browsingData”], be one of [“menus”, “contextMenus”], be one of [“geckoProfiler”], be one of [“sessions”], be one of [“contextualIdentities”], be one of [“downloads”, “downloads.open”, “downloads.shelf”], be one of [“management”], be one of [“privacy”], be one of [“proxy”], be one of [“nativeMessaging”], be one of [“theme”], be one of [“identity”], or match the pattern /^experiments(.\w+)+$/
1505316003540 addons.xpi DEBUG removeTemporaryFile: https://www.xxxx.de/pe/addon/myAddOn.xpi removing temp file C:\Users\xxxx\AppData\Local\Temp\tmp-o9c.xpi
1505316003541 addons.xpi WARN Failed to remove temporary file C:\Users\xxxx\AppData\Local\Temp\tmp-o9c.xpi for addon https://www.xxxx.de/pe/addon/myAddOn.xpi: [Exception… “Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.remove]” nsresult: “0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)” location: “JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: removeTemporaryFile :: line 1595” data: no] Stack trace: removeTemporaryFile()@resource://gre/modules/addons/XPIInstall.jsm:1595 < onStopRequest/<()@resource://gre/modules/addons/XPIInstall.jsm:2491
1505316003541 addons.xpi WARN Download of https://www.xxxx.de/pe/addon/myAddOn.xpi failed: Refusing to upgrade addon @MyAddOn to different ID {db1d9036-3bd1-47d5-aa6d-62a73935ffba}
1505316003543 addons.xpi DEBUG downloadFailed: removing temp file for https://www.xxxx.de/pe/addon/myAddOn.xpi
1505316003543 addons.xpi DEBUG removeTemporaryFile: https://www.xxxx.de/pe/addon/myAddOn.xpi removing temp file C:\Users\xxxx\AppData\Local\Temp\tmp-o9c.xpi
1505316003544 addons.xpi WARN Failed to remove temporary file C:\Users\xxxx\AppData\Local\Temp\tmp-o9c.xpi for addon https://www.xxxx.de/pe/addon/myAddOn.xpi: [Exception… “Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.remove]” nsresult: “0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)” location: “JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: removeTemporaryFile :: line 1595” data: no] Stack trace: removeTemporaryFile()@resource://gre/modules/addons/XPIInstall.jsm:1595 < downloadFailed()@resource://gre/modules/addons/XPIInstall.jsm:2526 < onStopRequest/<()@resource://gre/modules/addons/XPIInstall.jsm:2492

What does that mean? What can I do to make it work?

I think something is messed up in your manifest.json. Can you share it so I can look at it?
Also can you install the latest version normally, without an update?

Your update does not work due to some other issue. If you want your unlisted addon to ship updates then you need to have update_url in your manifest.json that should point to something like this example update.json.

This is the manifest file from the old version that I want to update:

{
  
  "name": "MyAddOn",
  "manifest_version": 2,
  "version": "1.10",
  "applications": {
	  "gecko": {
		    
			"update_url": "https://www.xxxx.de/pe/addon/updates.json"
		  }
	},
  
  "description": "xxxxxxxxxxxx",
  "content_scripts": [
    {
      "matches": [
        "http://*.xxxxx.com/*",
        "https://*.xxxxxx.com/*"
      ],
      "js": [ "MyScript.js" ],
      "run_at": "document_end"
    }
  ],
  "background": {
    "scripts": [ "jquery-3.2.0.min.js", "main.js" ],
    "persistent": false
  },
  "permissions": [
    "alarms",
    "cookies",
    "tabs",
    "unlimitedStorage",
    "http://*/*",
    "https://*/*"
  ]
}

and this is my update file:

{
    "addons": {
        "@MyAddOn": {
            "updates": [
				  { 
				  "version": "1.10",				 
				  "update_link": "https://www.xxxxxx.de/pe/addon/MyAddOn.xpi" 
				  },
				  { 
				  "version": "1.11",				 
				  "update_link": "https://www.xxxxx.de/pe/addon/MyAddOn.xpi" 
				  }
			  ]
        }
    }
}

Yes I can install the new version when I click on the link to the xpi file but then I have both addons installed at the same time

They have different id’s. Unzip the initial version of the signed extension and see what id it has. It is not @MyAddOn.

My example addon has the id {e34d5840-6b3b-49d8-92c2-9696798c4e2a}. If you did not put it in the manifest, one got generated in the signed extension you downloaded.

I’m not sure if I understand you right. I have unzipped the signed Version 1.10 and in the manifest file there is no ID at all (just like I copied it above). It’s the same in the manifest for 1.11. The only difference to both files it the version number. The same is valid for the update files. There is also the only difference the version number

how did you signed your extension?

Well I went tohttps://addons.mozilla.org/en-US/developers/addon/submit/upload-unlisted and uploaded my file and then downloaded the signed file

That’s how I did it with 1.9 1.10 and not 1.11

I find it quite odd that 1.9 and 1.10 have no id in manifest.json. Can you share the xpi?

no unfortunately I can’t because it’s an company internal addon

Where do I have to add an id for the next version? Is there a way to change the update json file so it may work or do our users have to remove the old addon manually and use a new one with an id in the manifest?

If you will create a new addon with a new id then they need to reinstall.

Please re-check the ID in the old addon. I think AMO does not allow extensions without an ID. If it is missing, a new one will be generated before signing. Sorry for my skepticism :smiley: I just never saw an addon without an ID.

Does it have a WEB-INF folder in the zip file?

Sorry for the late answer but I was sick. I checked the old and the new signed addon. In the meta-inf folder I looked at the rsa file and there I saw a difference:
in line 13 I see “@MyAddOn0

and in the new file I see
{xxxxxx-xxxxxx-xxxxx-xxxxx-xxxxxx}0

I guess thats the problem why it thinks that’s not the same addon. Right? Is there anything in the new addon manifest that I have to add so that @MyAddOn0 is the result and not the big number? In that case the old addons should recognize the update

If you’re still having trouble with this, you can send an email to amo-admins AT mozilla DOT org with the details. We can try looking into the XPIs and figuring out what’s wrong.

Please send an email to amo-admins AT mozilla DOT

Hello I found the reason for my problem. Instead of updateing my addon I created a new one with the same name. That’s why my old versions didn’t update at all.

1 Like

Cool! Glad everything works now :slight_smile: