-
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
Support userScripts permission in the permissions API #740
Comments
The single-step In order to avoid having to asynchronously request |
The
The usual behavior is to hide API namespaces and/or methods when the required permission has been revoked. Firefox implements that behavior in the userScripts API, which does indeed mean that Chrome's current behavior when access has not been granted is to throw an error when the
|
The userScripts API is currently implemented by Chrome and Firefox, and both require express user consent to enable the API.
In Chrome, this is currently implemented as requiring the user to check the "Developer Mode" checkbox. If not checked, an attempt to access the
chrome.userScripts
namespace throws an error (https://developer.chrome.com/docs/extensions/reference/api/userScripts#developer_mode_for_extension_users). There is no way for extension developers to know whether the user checked the checkbox (feature request: https://issues.chromium.org/issues/40942783).In Firefox, this is implemented by requiring "userScripts" to be in
optional_permissions
(not inpermissions
), so that the user can either use the built-in extension permission management UI, or callpermissions.request()
to request the permission. This permission request has additional requirements to make sure that users cannot mindlessly approve the permission request, as shown in the screenshots at https://bugzilla.mozilla.org/show_bug.cgi?id=1917000When "userScripts" access is modeled as an optional permission, extension developers can use the standard
permissions.contains()
,permissions.onAdded
andpermissions.onRemoved
APIs to be notified of access changes, and react accordingly.The behavior of
permissions.request()
can be customized depending on what the browser wants:I'm proposing for the "userScripts" opt-in to be modeled as an optional permission, so that the
permissions
API can be used to detect and monitor the availability of theuserScripts
API.The text was updated successfully, but these errors were encountered: