Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Extension Browser API: Promise Returns, Methods, and Version Gates

How extension browser.* APIs return Promises, which Chrome versions support them, and what limits apply to common methods.

This page summarises Chrome extension reference material for the browser.* namespace: asynchronous methods that return Promise values, the Chrome version notes attached to each call, and behaviour that matters when you ship or debug an extension. The same pattern appears across APIs such as tabs, runtime, permissions, and storage.

browser.* APIs: why everything looks like a Promise

Section titled “browser.* APIs: why everything looks like a Promise”

In the extension reference, most browser.<api>.<method>() calls are documented with a Returns section that names a Promise<...> type (for example Promise<void>, Promise<Tab>, or Promise<Tab[]>). That is the contract extension authors use with async/await or .then() instead of callback-style APIs.

Promise support was added for extension contexts in Chrome 99. When communicating from a web page to an extension, promises are available from Chrome 118.

— Google Chrome, runtime API

Common conclusion: treat browser.* as the promise-oriented surface in extension code running in trusted extension contexts; plan for Chrome 99+ in those contexts, and Chrome 118+ if a normal web page must await extension responses.

Documented return Typical meaning
Promise<void> Work finished; no payload (success often means “resolved”, failure means “rejected”)
Promise<boolean> Yes/no outcome (for example whether an operation succeeded or a resource existed)
Promise<number> Numeric id or count (download id, alarm state, and similar)
Promise<object> / typed object Structured data (permissions, platform info, key–value maps from storage)
Promise<T | undefined> Optional result when the target may not exist (a tab, cookie, or tab group)
Promise<T[]> Lists (tabs, cookies, commands, capture info)

Many pages repeat the version line *“Chrome NN+ browser. since Chrome 148”**, meaning the promise-based browser.* form is what current reference targets; always check the minimum Chrome NN+ on the specific method you call.

Version and manifest gates: MV3, ChromeOS, and exceptions

Section titled “Version and manifest gates: MV3, ChromeOS, and exceptions”

Several methods add constraints beyond a single Chrome version number.

Host access request helpers on permissions are tagged MV3+ and require recent Chrome:

browser.permissions.addHostAccessRequest( request: object, ): Promise<void> — Adds a host access request. Request will only be signaled to the user if extension can be granted access to the host in the request. Request will be reset on cross-origin navigation. When accepted, grants persistent access to the site’s top origin

— Google Chrome, permissions API

browser.permissions.removeHostAccessRequest( request: object, ): Promise<void> — Removes a host access request, if existent.

— Google Chrome, permissions API

runtime.getContexts is another MV3+ entry point:

browser.runtime.getContexts( filter: ContextFilter, ): Promise<ExtensionContext[]> — Fetches information about active contexts associated with this extension

— Google Chrome, runtime API

Some promises only matter on managed devices. On idle, auto-lock delay is ChromeOS only:

browser.idle.getAutoLockDelay(): Promise<number> — Gets the time, in seconds, it takes until the screen is locked automatically while idle. Returns a zero duration if the screen is never locked automatically. Currently supported on Chrome OS only.

— Google Chrome, idle API

runtime.restart and runtime.restartAfterDelay reboot the device only in kiosk mode; elsewhere they are effectively no-ops, and repeated delayed restart has ownership rules documented on the same page.

Not every browser.* symbol is async. For example:

browser.runtime.getVersion(): string — Returns the extension’s version as declared in the manifest.

— Google Chrome, runtime API

Do not await a synchronous return type; mixing styles in one module is a common mistake.

browser.tabs and UI surfaces: navigation, memory, and split view

Section titled “browser.tabs and UI surfaces: navigation, memory, and split view”

The tabs API is a hub for Promise<Tab> and Promise<void> operations.

browser.tabs.goBack( tabId?: number, ): Promise<void> — Go back to the previous page, if one is available.

— Google Chrome, tabs API

browser.tabs.goForward( tabId?: number, ): Promise<void> — Go foward to the next page, if one is available.

— Google Chrome, tabs API

browser.tabs.discard( tabId?: number, ): Promise<Tab | undefined> — Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated.

— Google Chrome, tabs API

browser.tabs.createSplit( tabIds: [number, number], ): Promise<number> — Splits two existing tabs into a Split View.

— Google Chrome, tabs API

browser.tabs.unsplit( splitViewId: number, ): Promise<void> — Separates the tabs in a Split View into independent tabs.

— Google Chrome, tabs API

sidePanel complements tabs UI work:

browser.sidePanel.close( options: CloseOptions, ): Promise<void> — Closes the extension’s side panel. This is a no-op if the panel is already closed.

— Google Chrome, sidePanel API

browser.sidePanel.getLayout(): Promise<PanelLayout> — Returns the side panel’s current layout.

— Google Chrome, sidePanel API

Storage, scripting, and capture: promises that hide limits

Section titled “Storage, scripting, and capture: promises that hide limits”

Reads and writes resolve or reject explicitly:

Promise that resolves on success, or rejects on failure.

— Google Chrome, StorageArea

browser.storage.StorageArea.getKeys(): Promise<string[]> — Gets all keys from storage.

— Google Chrome, StorageArea

browser.storage.StorageArea.setAccessLevel( accessOptions: object, ): Promise<void> — Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.

— Google Chrome, StorageArea

Injection promises carry per-frame results:

Returns a Promise which resolves upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.

— Google Chrome, scripting API

A resolved Promise<string> is not a long-lived capability:

Returns a Promise which resolves with the result. If successful, the result is an opaque string that can be passed to the getUserMedia() API to generate a media stream that corresponds to the target tab. The created streamId can only be used once and expires after a few seconds if it is not used.

— Google Chrome, tabCapture API

browser.userScripts.getWorldConfigurations(): Promise<WorldProperties[]> — Retrieves all registered world configurations.

— Google Chrome, userScripts API

browser.userScripts.resetWorldConfiguration( worldId?: string, ): Promise<void> — Resets the configuration for a user script world. Any scripts that inject into the world with the specified ID will use the default world configuration.

— Google Chrome, userScripts API

Enterprise, debugger, and file providers: rejection and side effects

Section titled “Enterprise, debugger, and file providers: rejection and side effects”

Attach and detach promises settle without a value but reject on failure:

Resolves once the attach operation succeeds or fails. The promise resolves with no value. If the attach fails, the promise will be rejected.

— Google Chrome, debugger API

The same pattern is documented for detach.

PIN flows can reject when the user dismisses the dialog:

Returns a Promise which resolves when the PIN is provided by the user. Rejects with an error if the dialog request finishes unsuccessfully (e.g. the dialog was canceled by the user or was not allowed to be shown).

— Google Chrome, certificateProvider API

notify() is a Promise<void> with detailed changelog semantics; manifest permission file_system_provider.notify must be enabled. Tags must be non-empty and unique per call; parent removal implies descendant removal. On error, runtime.lastError is set.

browser.mimeHandler.abortAndFallbackToNativeHandler(): Promise<void> — Aborts current stream handling and hands the content off to the user agent’s native handler. After this call the extension frame will be torn down; callers should not expect further execution.

— Google Chrome, mimeHandler API

Toolbar action state:

browser.action.getUserSettings(): Promise<UserSettings> — Returns the user-specified settings relating to an extension’s action.

— Google Chrome, action API

DevTools extension APIs: promise callbacks on network and inspected window

Section titled “DevTools extension APIs: promise callbacks on network and inspected window”

devtools.network documents promise-based content helpers (Chrome 151+ / 152+ on some entries):

A function that receives the response body when the request completes.

— Google Chrome, devtools/network API

devtools.inspectedWindow resolves with evaluation results or resource lists when async inspection completes.

devtools.panels notes Chrome 152+ promise callbacks when a resource load finishes.

Common mistakes when using browser.* Promises

Section titled “Common mistakes when using browser.* Promises”
  • Assuming every method returns a Promise — verify the Returns block; runtime.getVersion() is synchronous.
  • Ignoring undefined in Promise<T | undefined> — discarded or missing tabs and optional cookies need guards.
  • Treating resolved Promise<void> as proof of user success — certificate PIN and debugger attach can reject after UI cancellation or policy blocks.
  • Holding tab capture streamId too long — consume it once, immediately, per tabCapture.
  • Calling ChromeOS-only APIs on desktop — check labels such as ChromeOS only on idle and power.reportActivity.
  • Using MV2-only mental models on MV3 — host access request APIs and getContexts require Manifest V3 and the versions stated on permissions and runtime.
  1. Open the official reference page for the API you use (for example runtime or tabs) and confirm each called method’s Returns type and Chrome NN+ note matches your support matrix.

  2. In a test extension build, wrap calls in try/catch and log rejections for methods that document failure paths (for example debugger attach or certificateProvider PIN).

  3. For MV3-only flows, verify manifest version and exercise permissions.addHostAccessRequest and runtime.getContexts on a current Chrome channel.

  4. For capture or storage features, re-read limit text on tabCapture and StorageArea.setAccessLevel against your extension’s contexts (service worker vs content script vs extension page).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page disagrees with the linked Chrome documentation or omits an important limit, email yimasynthetic@gmail.com with the page URL and the exact statement you are questioning.