Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

JEP Add on URLs

Irakli Gozalishvili edited this page Feb 27, 2012 · 1 revision

Problem

All the files from SDK based add-ons get obscured URLs.

  • This is confusing for developers
  • This provides poor UX for add-on pages as they get unmemorable URLs (While on desktop it's less problematic, because of hidden location bar, it's still forces add-on authors to make a button just to open this page. Also on mobile chrome pages do have location bar so it's even more problematic)
  • Some add-on authors use third party modules to solve this issue via pretty about:nosy URLs. Unfortunately it's not perfect either as there is no built-in conflict resolution mechanism and add-on may break each other by using conflicting URLs.

Solution

Each add-on should get a unique root URL and all the add-on content should be available under that URL. URL host should be unique add-on name making it to remember it:

addon:nosy                      -> {ADDON_PATH}/index.html
addon://nosy                    -> {ADDON_PATH}/index.html
addon://nosy/index.html         -> {ADDON_PATH}/index.html
addon://nosy/data/icon.png      -> {ADDON_PATH}/data/icon.png

Special addon protocols may in a future get a special UI in the browser too.

Migration

Unfortunately today package.json:name is not unique neither it's validity is enforced by add-on builder or cfx (see CommonJS/Packages/1.0 for details). Which makes it poor fit for a add-on hostname. On the other hand there is id field with a better name, but it's auto generated and will be hard for an average user to remember.

SDK may introduce new package descriptor field title that can be used instead of current name. Both SDK and Add-on builder can auto rename name to title and copy id with stripped out @jetpack to name. This way all add-ons will work as before and all of them will get a unique name (since add-on id is unique). In a future both builder and cfx will enforce uniqueness of name. All the new id's also can be generated from a name just by prefixing them with @. To ensure unique name of an add-on we will need to make AMO validate that unless there is a field in install.rdf that already can be used for that.