Overview of Manifest V3 states:
Is there a list of APIs that has been converted to Promise?
For example, the following runs into error:
chrome.contextMenus.removeAll()
.then(() => console.log('done'));
// Uncaught TypeError: Cannot read properties of undefined (reading 'then')
I'm not aware of such a list but the support status for a given method will be shown in an IDE (via a tooltip or a method preview or a "Go to definition" command) if you install the official chrome-types package. Don't confuse it with @types/chrome
by DefinitelyTyped offered in many IDE by default. The important difference is that the official package is autogenerated from the source code of Chromium, so it should reflect reality, although theoretically their crawler may have bugs.
To see which version of Chrome added the support there's no convenient method yet, so you'll have to check the source code directly and use the Blame
feature inside.
Example 1, chrome.contextMenus.removeAll
. Search for the method name removeAll
using an expression like \bremoveAll\b file:extension.*(json|idl)$ (\b
means boundary like a space or a doublequote), you'll see a file named "context_menus", click it, and look at the definition. Only callback
is there, no async
or Promise
, which means it's not converted yet.
Example 2, chrome.tabs.sendMessage
. The definition says returns_async
, i.e. it supports Promise.
Blame
button in the top right corner.returns_async
line.chromiumdash.appspot.com/commit/
so in our example it'll be
chromiumdash.appspot.com/commit/2cfa204a0da496b42c3a148d014df4aef45c43fc"minimum_chrome_version": "99"
in manifest.json to ensure that users of older browsers won't install the extension and won't receive it in an automatic update. In case you really want to support users of older browsers you'll have to use this method in callback mode or apply your own promisifier.