Extension fails to load if an unrecognized property is set in browser_specific_settings.gecko
Categories
(WebExtensions :: General, task, P3)
Tracking
(firefox128 fixed)
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:
- Create manifest.json containing:
{
"name": "test",
"version": "1",
"manifest_version": 2,
"browser_specific_settings": {
"gecko": {
"some_new_prop": "some value"
}
}
}
- 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
Comment 1•3 years ago
|
||
We might have a bug for this somewhere. This is why distribution control put the key in the top level rather than in bss.
Comment 2•3 years ago
|
||
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.
Updated•3 years ago
|
Assignee | ||
Comment 4•10 months ago
|
||
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.
Updated•9 months ago
|
Assignee | ||
Updated•6 months ago
|
Docs ready for review: RN for browser_specific_settings.gecko unrecognized property support #34608
Description
•