How to test optional permissions in a Chrome extension? How to test optional permissions in a Chrome extension? google-chrome google-chrome

How to test optional permissions in a Chrome extension?


Turns out I confused myself by requesting the "sessions" permission when the extension already had a required "tabs" permission. Apparently, requesting "sessions" when you already have "tabs" doesn't trigger the permissions dialog.

However, calling something like chrome.permissions.request({ permissions: ["bookmarks"] }) does, in fact, show the permissions dialog, even in an unpacked extension.

So the answers are:

  1. There's no need to publish an extension to the Chrome Webstore. Just request an optional permission with your local unpacked extension to see the dialog.

  2. It looks like the only way to trigger the permissions dialog again is to delete the extension completely and reinstall it. Calling chrome.permissions.remove() does remove it as far as the APIs go, but the permission is silently re-added if it's requested again.