javascriptfirefoxfirefox-addonbrowser-addons

Firefox `browser.identity.getRedirectURL()` uses random id instead of extension ID in URL


browser.identity.getRedirectURL() returns https://3347c8cebdf365b6de12af5ab0927a76cf6421c3.extensions.allizom.org/ even though in manifest.json browser_specific_settings.gecko.id is set to contexto-transletto@bstrama.com.

The Extension ID shows correctly in the extension details:

enter image description here

I tried a lot of things, including asking MDN AI, reading docs, and other stuff but I haven't seen any similar problems.

BTW here's my manifest.json:

{
  "manifest_version": 2,
  "name": "Contexto transletto",
  "version": "1.0",
  "description": "TODO: Write a description",
  "permissions": [
    "contextMenus",
    "tabs",
    "identity",
    "activeTab",
    "scripting",
    "http://localhost/*",
    "http://127.0.0.1/*"
  ],
  "browser_specific_settings": {
    "gecko": {
      "id": "contexto-transletto@bstrama.com"
    }
  },
  "background": {
    "scripts": [
      "background.js"
    ],
    "persistent": false
  },
  "browser_action": {
    "default_popup": "popup.html",
    "default_icon": {
      "16": "images/logo/date-time-16.png",
      "32": "images/logo/date-time-32.png",
      "48": "images/logo/date-time-48.png",
      "128": "images/logo/date-time-128.png"
    },
    "default_title": "Getting Started Example"
  },
  "icons": {
    "16": "images/logo/date-time-16.png",
    "32": "images/logo/date-time-32.png",
    "48": "images/logo/date-time-48.png",
    "128": "images/logo/date-time-128.png"
  }
}

Solution

  • If you look at the actual implementation of getRedirectURL in Firefox it becomes obvious that this is a hash of your extension ID.

    let hash = computeHash(extension.id);
    let url = new URL(`https://${hash}.${redirectDomain}/`);
    

    This also means there is nothing you can do to change this URL (except the path of course).