Closed Bug 1757293 Opened 3 years ago Closed 6 months ago

Extension fails to load if an unrecognized property is set in browser_specific_settings.gecko

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(firefox128 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [addons-jira])

Attachments

(1 file)

The manifest schema of the browser_specific_settings.gecko object is at https://searchfox.org/mozilla-central/rev/99a293b5c42bf62da2c7a0a65c7210d10f392a9f/toolkit/components/extensions/schemas/manifest.json#567-592

It specifies a set of properies, but without "additionalProperties": { "$ref": "UnrecognizedProperty" }.

Consequently, if we ever add a new property, and extensions want to use it, then extension authors will be forced to drop compatibility for older versions, because we currently fail hard when a property is set.

To allow us to add new properties in the future, we should add "additionalProperties": { "$ref": "UnrecognizedProperty" }.

STR:

  1. Create manifest.json containing:
{
  "name": "test",
  "version": "1",
  "manifest_version": 2,
  "browser_specific_settings": {
    "gecko": {
      "some_new_prop": "some value"
    }
  }
}
  1. Visit about:debugging and try to load the directory containing the above manifest.json

Expected:

  • Extension loads, browser console may contain a warning.

Actual:

  • Extension fails to load, browser console contains error:

1645913168328 addons.webextension.<unknown> ERROR Loading extension 'null': Reading manifest: Error processing browser_specific_settings.gecko: Unexpected property "some_new_prop"

Error: Extension is invalid

We might have a bug for this somewhere. This is why distribution control put the key in the top level rather than in bss.

We should try to do this before next ESR. Thee issue with making it more relaxed, we risk typos making the extension behave unexpectedly.

To counter that, we could make thee id property required if the gecko key is present. Luca suggested we might be more strict in the linter, but keep it more relaxed in Firefox.

Assignee: nobody → rob
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [addons-jira]
See Also: → 1831417
Duplicate of this bug: 1747443

Implementation changes:

  • browser_specific_settings.gecko: treat unrecognized keys as warnings
    instead of hard errors.
  • browser_specific_settings.gecko_android: treat unrecognized keys as
    warnings instead of silently ignoring them.

Test change (besides adding coverage for the implementation changes):

  • Moved test_non_gecko_bss_install from test_webextension_install.js to
    test_ext_manifest.js, because the test is related to manifest parsing
    and the test is currently skipped on Android.
Priority: P2 → P3
Blocks: 1898471
Keywords: dev-doc-needed
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/7089d61e0531 Warn on unrecognized bss.gecko/gecko_android keys r=willdurand
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: