-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request: manifest error handling for unknown properties #14
Comments
Safari also supports |
More details about the |
The following is copied from a bugzilla.mozilla.org issue that I made requesting the ability to set general manifest settings for particular browsers. Steps to reproduce:One of the benefits of webextensions is being able to create a cross-platform browser extension from the same code base. Unfortunately, different browsers behave differently so there needs to be ways to account for the differences in the code and the configuration. browser_specific_settings allows setting specific settings for each browser. I'd like the ability to override any property from the root of the manifest in a similar way. For example, on Chrome you're not allowed to set both the new tab and homepage. However, on Firefox you are, and the homepage is used to control the new window page. Example code: {
"manifest_version": 2,
"name": "Renewed Tab",
"chrome_url_overrides" : {
"newtab": "app/webext.html"
},
"browser_specific_settings": {
"gecko": {
"chrome_settings_overrides": {
"homepage": "app/webext.html"
}
}
}
} Actual results:The example code resulted in an error, as chrome_settings_overrides wasn't an expected field Expected results:It should have overridden chrome_settings_overrides on Firefox (=gecko) only |
@therealglazou, could you expand on the use case for author-defined values? My initial reaction is that retrieving other JSON data seems like it would be better served by fetching a separate JSON file. |
If such syntax is introduced, it should receive it's own property within So we could go for something like this: Or do something like this: As an extension developer myself. I do see the use case in this. In the past I wanted to introduce a different name for an extension for firefox. Then there is |
Several reasons:
|
An issue has been opened on ignoring some of these for Chromium: |
@therealglazou Allowing custom author-defined values can conflict with future additions to the extension APIs. In addition it makes it harder to find issues in the extension manifest. As mentioned, additional info can easily go into a separate json file you fetch in the code. or using a security.txt, readme.md, license.txt or similar. |
Lets not forget about custom / unknown properties further down the manifest.json three. See: |
An issue related to how to handle manifest unknown keys / unsupported keys on Firefox can be found here: |
@dotproto, do you remember if there were any updates from the Chromium side here? I feel like it came up in a more recent meeting but I don't see that in the notes. |
This topic has come up a few times, and the consensus is to not fail hard unless really necessary. Unrecognized top-level keys already are already "ignored", as in not triggering hard failures that prevent the installation of an extension across browsers. Chrome and Firefox both print warnings about unrecognized properties as a debugging aid. Safari's implementation only refuses the manifest in really dire situations, such as the manifest being invalid JSON. Firefox's implementation currently accepts unrecognized manifest keys in many manifest fields, but there are also plenty that do not, because in our implementation the permissive behavior is opt-in. Because of this, sometimes an unrecognized manifest key causes a hard installation failure. We are willing to change this for manifest.json validation. Chrome's manifest validation is customized for each manifest key. The default behavior is to ignore unknown properties, with some exceptions for cases where Chrome is concerned about the presence of an unsupported key. |
I think the root of this problem is that the current extension manifest file only has implementations but no standard specification. Some properties or values cannot be simply ignored, and some can. What are the validation rules? This requires establishing a specification first. Then browsers adjusts their behavior according to the specification. |
I think we'll want to have more discussion as we talk about specific changes more, but in general Chrome is supportive of this. |
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1831417 to track the ability to treat unrecognized manifest keys as warnings instead of errors, by default. |
We discussed this at our in person meeting in San Diego. All browsers are generally supportive of not having hard errors in most cases, and we are making changes in that direction, e.g Chrome's change to handling of background manifest keys. Changes to Closing this since there isn't a specific action item but hope we can continue making progress here. |
An issue hit by all WebExtension vendors is related to manifest properties unrecognized by a given browser. A good example is
browser_specific_settings
that Firefox relies on but Chrome does not accept at all, triggering a manifest error on install. This forces all of us to have two different manifests or dynamically generate them or even have two different builds.I think we could/should specify two things wrt manifest:
chrome.runtime.getManifest()
The text was updated successfully, but these errors were encountered: