web-monetization-projects icon indicating copy to clipboard operation
web-monetization-projects copied to clipboard

Firefox applications vs browser_specific_settings manifest keys

Open sublimator opened this issue 2 years ago • 1 comments

image

Can we use just one ? If so, which ? Added "applications" because @wext/shipit cli publisher for FF add-ons seems to require it somewhere.

sublimator avatar Mar 16 '22 03:03 sublimator

Can't actually find any documentation for "applications"

  • [x] Why does wext/shipit require it then?
    • [x] Check the shipit source (it uses web-ext)
    • [x] what version of web-ext does shipit depend on ? 3.2.0
      •   // version 3.2.0
          export function getManifestId(manifestData: ExtensionManifest): string | void {
            return manifestData.applications ?
              manifestData.applications.gecko.id : undefined;
          }
        
      •   // version 6.8.0
          export function getManifestId(manifestData: ExtensionManifest): string | void {
            const manifestApps = [
              manifestData.browser_specific_settings,
              manifestData.applications,
            ];
            for (const apps of manifestApps) {
              // If both bss and applicants contains a defined gecko property,
              // we prefer bss even if the id property isn't available.
              // This match what Firefox does in this particular scenario, see
              // https://searchfox.org/mozilla-central/rev/828f2319c0195d7f561ed35533aef6fe183e68e3/toolkit/mozapps/extensions/internal/XPIInstall.jsm#470-474,488
              if (apps?.gecko) {
                return apps.gecko.id;
              }
            }
        
            return undefined;
          }
        

So it seems it's not the add-on store that requires the applications key in the manifest, it's just the shipt cli which is using an old version of web-ext.

Actually, that code may not be relevant to the issue.

  • [x] What was the actual error message that shipit gave?
    • tried dev build on main branch
      • initially complained about duplicate id
      • changed id to [email protected] then it failed validation (js files too large, not production minified)
      • try publishing to the wm2 extension (CoilWM2Preview) and see what error, if any
        •   Applying config file: ./package.json
            Building web extension from /Users/nicholasdudfield/projects/web-monetization/packages/coil-extension/dist
            No extension ID specified (it will be auto-generated)
            FAIL
          
            o: The extension could not be signed
          

In any case, it seems like "applications" is

  • not the first choice to set the id in the latest version of web-ext
  • not documented anywhere

TODO:

  • [ ] Update shipit to use the latest version of web-ext
  • [ ] Remove "applications" from makeWebpackConfig

sublimator avatar Apr 05 '22 09:04 sublimator