Request optional permissions without toolbar button #2011
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firefox bug 1382953 has been fixed for Firefox 61 and Firefox ESR 60. This means that we can request optional permissions without using the toolbar button.
This implementation attempts to request the permission without the toolbar button and if that fails it then tries to use the toolbar button instead. This can be useful since it allows permission to be request at times when the user hasn't done one of the interactions required to be allowed to request permissions.
It also tracks if a request is currently pending and cancels all request until the current one is either allowed or denied. If this is not done then the user can click multiple times on the request button and the requests will be queued so that when the current request is denied it will appear again and again until the queue is emptied.