Look into alternatives to the empty enum entry part of the OptionalOnlyPermission API schema
Categories
(WebExtensions :: General, task, P3)
Tracking
(Not tracked)
People
(Reporter: rpl, Unassigned)
References
Details
(Whiteboard: [addons-jira])
While importing the WebExtensions JSONSchema for Firefox 134 and 135 in the addons-linter project we have noticed that ajv considers an empty enum array as invalid JSONSchema.
In the short term we are workarounding this on the addons-linter side by injecting one of the existing optional-only permisions ("userScripts") in the empty array entry, for more details about the workaround see addons-linter pull request importing Firefox 134 and 135 schema data.
This bugzilla issue is tracking looking into an alternative to that workaround to be applied on the Firefox side, so that we can then get rid of the short term workaround applied on the addons-linter side along with importing the updated JSONSchema from Firefox (which is tracked by https://github.com/mozilla/addons-linter/issues/5553).
Reporter | ||
Updated•1 month ago
|
Comment 1•1 month ago
|
||
"userScripts" is implemented in toolkit/, so in theory we could move its definition from schemas/user_scripts.json to schemas/manifest.json without breaking anything.
From the code organization point of view, it is rather strange to put this permission outside of the usual definitions, but if there is a strong need for it, we could consider it. There is already one other permission that is defined in schemas/manifest.json
, while the API itself is defined elsewhere:
notifications
permission definition: https://searchfox.org/mozilla-central/rev/345ec3c55ddda5f0ce37168f0644dcdcc4834409/toolkit/components/extensions/schemas/manifest.json#488notifications
API schema: https://searchfox.org/mozilla-central/rev/345ec3c55ddda5f0ce37168f0644dcdcc4834409/toolkit/components/extensions/schemas/notifications.json
NOTE: the userScripts
permission is only available in MV2. This is not enforced at the schema level, because that would require separation of permission enums by manifest versions, which would add some complexity. It is enforced at the extension parsing level, through https://searchfox.org/mozilla-central/rev/345ec3c55ddda5f0ce37168f0644dcdcc4834409/toolkit/components/extensions/Extension.sys.mjs#262-267
Reporter | ||
Updated•29 days ago
|
Updated•29 days ago
|
Reporter | ||
Updated•17 days ago
|
Reporter | ||
Comment 2•13 days ago
•
|
||
Rob, William and myself have touched base about this and we agreed to leave the schema as is on the Firefox side (and wontfix this issue) and instead aim to remove the workaround we are currently using on the addons-linter side by reworking the way we import the schema data into the addons-linter (e.g. by merging the multiple separated JSONSchema files into a single normalized JSONSchema file, tracked by https://github.com/mozilla/addons-linter/issues/4511, where the enum wouldn't be empty because all the values added to the enum from the per-API JSONSchema files would be merged into the enum at addons-linter's "Firefox API schema import"-time)
Description
•