Closed Bug 1879689 Opened 2 years ago Closed 1 year ago

Additional permissions prompt not listing the optional permissions being requested

Categories

(Thunderbird :: Add-Ons: General, defect, P1)

Thunderbird 115
defect

Tracking

(relnote-thunderbird 140+, thunderbird_esr115 wontfix, thunderbird_esr128 wontfix, thunderbird138 affected, thunderbird139 affected, thunderbird140 fixed)

RESOLVED FIXED
140 Branch
Tracking Status
relnote-thunderbird --- 140+
thunderbird_esr115 --- wontfix
thunderbird_esr128 --- wontfix
thunderbird138 --- affected
thunderbird139 --- affected
thunderbird140 --- fixed

People

(Reporter: alex, Assigned: john)

References

Details

Attachments

(1 external file)

Steps to reproduce:

My MailExtension has an optional permission, "clipboardRead", that is listed in the optional_permissions block in the extension manifest. The call to navigator.clipboard.readText() in the extension is wrapped in a try...catch block, and in the catch block, I make a call to messenger.permissions.request() to request the user to grant the optional permission.

But the permissions prompt that appears in Thunderbird doesn't list the optional permission being requested; instead, it lists the same mandatory permissions that is requested when the extension was installed.

STEPS TO REPRODUCE:

  1. Install the Snippets extension. Link to GitHub repo: https://github.com/aecreations/snippets - latest release is version 2.0
  2. Copy some text to the clipboard. For example, locate an old email message in Thunderbird and copy its content.
  3. In the main Thunderbird window, click New Message to open a new message compose window
  4. Click the Snippets button on the composer toolbar to open the Snippets window
  5. In the Snippets window, under "Create new snippet", click the "From Clipboard" button.
  6. Click OK to the message box requesting that the additional permission to get data from the clipboard should be granted
  7. A puzzle piece icon should appear in the main Thunderbird window. Click on the icon to display the additional permissions prompt

Actual results:

The additional permissions prompt incorrectly requests the mandatory permissions that are defined in the permissions block in the extension manifest:

  • Read and modify your email messages as you compose and send them
  • Download files and read and modify the browser's download history

Expected results:

The additional permissions prompt should request the optional permission that is defined in the optional_permissions block in the extension manifest:

  • Get data from the clipboard

Confirmed. I reached out to the team how to move this forward. This seems to be very much broken: not showing the prompt in the composer, but in the main window (and only after switching to it) is confusing.

Note: In Daily this does not work, because you are losing the user-input-handler and the optional permission prompt is not shown at all.

To make your add-on work, you need to request the permission directly. We will fix this, but it needs proper planing.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → john
Status: NEW → ASSIGNED
Priority: -- → P1

This patch fixes the wrong (or no) permissions being shown for optional
permission prompts. It also pulls in some upstream changes for the used
strings.

Blocks: 1956034

Thank you for your patience, this one indeed took a while to get fixed. The patch adds a test to ensure this functionality is not breaking again.

We have decided that we will not implement permission prompts on other windows besides the main Thunderbird window. I saw that you modified your add-on already to not request the permission from the popup window. If the user could trigger permission requests while not interacting with the main Thunderbird window, we propose the following:

  • use browser.permissions.contains() to check if a permission is granted or not and enable/disable support for the related feature
  • the relevant UI could have a pointer to a help page about the feature (which is opened in a normal tab), which may have a button "request permission", which could then use browser.permissions.request() to request the permission.
  • the relevant UI could also offer a link to open the options page via runtime.openOptionsPage() to allow the user to enable the permission.
Target Milestone: --- → 140 Branch

Pushed by corey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/3de5a4b81d06
Fix optional permission prompts and port other related changes. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED

Release Note Request (optional, but appreciated)
[Why is this notable]: Optional permission prompts were either empty or showed the wrong permissions.
[Suggested wording]: Fixed: Optional permission prompts for WebExtensions displayed the wrong permissions
[Links (documentation, blog post, etc)]:

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: