Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Extension API Details Objects, Permissions, and Authentication

How Chrome extension APIs use details objects, host permission UI, certificate PIN flows, and WebAuthn proxy requests.

This page summarizes Chrome extension API reference material from Chrome for Developers, centered on the promise-based browser.* namespace and closely related chrome.* surfaces. The cluster covers how many methods pass structured details (or request) objects, how permission prompts are scoped to tabs or URL patterns, and how several security-sensitive APIs chain request IDs, allow/deny handlers, and user input back to the extension.

browser.* and chrome.*: which API surface to use

Section titled “browser.* and chrome.*: which API surface to use”

Extension code can call either the browser namespace (WebExtensions-style, promise-based) or the chrome namespace (Chrome-specific, often callback-based). Several reference pages note minimum Chrome versions for browser.* entry points—for example, browser.devtools.inspectedWindow documents getContent and setContent as available with Chrome 151+ browser.* since Chrome 152, and browser.identity lists Chrome 84+ browser.* since Chrome 148 for profile-related details.

Surface Typical call style Where this cluster shows it
browser.* Promises, details objects browser.permissions, browser.certificateProvider, browser.webAuthenticationProxy
chrome.* (MV2 reference) Callbacks, same shapes in places chrome.certificateProvider, chrome.desktopCapture
Embedded UI (chrome.webviewTag) DOM events + allow() / deny() on request objects chrome.webviewTag

For new extension work, start from the MV3 browser.* reference and mirror any legacy chrome.* page only when you still ship MV2 or Chrome Apps–era code.

Developers usually hit these pages when TypeScript types or runtime errors mention a missing field on details, when a permission banner appears on the wrong tab, when a corporate PIN dialog must be wired to certificateProvider, or when passkey flows need the extension to answer webAuthenticationProxy events.

The details parameter: shared pattern across APIs

Section titled “The details parameter: shared pattern across APIs”

A large share of methods in this cluster take a single object argument named details (or request for rule testing). That object carries tab/frame context, tokens, certificates, or dialog configuration instead of many positional parameters.

Examples from the reference:

browser.fontSettings notes that its optional details object is currently unused—worth remembering so you do not invent fields that the platform ignores.

Practical rule: match the exact typedef name from the method you call; partial objects are only valid where the docs say Partial* (for example workbox-core uses PartialCacheNameDetails for cache naming, which is separate from extension permissions but follows the same “one details bag” pattern).

Host permissions: where the prompt appears (browser.permissions)

Section titled “Host permissions: where the prompt appears (browser.permissions)”

Host access prompts can be tied to a tab, a top-level document, or a URL pattern, so the user sees the request in the right place and it is cleared on navigation.

From browser.permissions, the request object supports:

Field Role
tabId Show the request on that tab; removed when the tab navigates to a new origin. Overrides an existing request for documentId. Either tabId or documentId is required.
documentId Show on the tab of that document; must be the top-level document in the tab. Same navigation cleanup. Overrides requests for tabId.
pattern If set, host access requests are shown only on URLs matching this pattern.

Adding a new request will override any existent request for tabId. This or tabId must be specified.

— Google, browser.permissions

Common mistakes: passing a subframe documentId, omitting both tabId and documentId, or expecting multiple stacked prompts on one tab—the latest request wins.

browser.certificateProvider: certificates, PIN dialogs, and attempt limits

Section titled “browser.certificateProvider: certificates, PIN dialogs, and attempt limits”

Enterprise and smart-card flows use browser.certificateProvider (and the MV2 twin chrome.certificateProvider) to supply certificates and handle signing PIN UI.

Setting certificates and reporting signatures

Section titled “Setting certificates and reporting signatures”
  • setCertificates takes SetCertificatesDetails; invalid certificates are ignored.
  • reportSignature takes ReportSignatureDetails.
  • Incoming work includes certificatesRequestId (pass to setCertificates) and signRequestId (from SignRequest).

When Chrome asks the extension to show a PIN (or similar) dialog, RequestPinDetails describes the UI. Related fields on pin events include:

Property Meaning
userInput Code from the user; empty if the user closed the dialog or another error occurred.
attemptsLeft For UI only; Chrome does not enforce the limit—the extension must call stopPinRequest with errorType = MAX_ATTEMPTS_EXCEEDED when appropriate.
errorType Template shown after a failed request or when stopping the flow (e.g. MAX_ATTEMPTS_EXCEEDED).
requestType Type of code requested; default PIN.
signRequestId ID from SignRequest.

Chrome is not expected to enforce this, instead stopPinRequest should be called by the extension with errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is exceeded.

— Google, browser.certificateProvider

StopPinRequestDetails carries the reason for ending the flow; set errorType when stopping due to an error so the user sees an explanation.

browser.webAuthenticationProxy: passkeys and JSON-serialized WebAuthn

Section titled “browser.webAuthenticationProxy: passkeys and JSON-serialized WebAuthn”

browser.webAuthenticationProxy lets an extension satisfy navigator.credentials.create() / get() on behalf of another context by exchanging JSON payloads and opaque requestId values.

Creation side:

  • requestDetailsJson — PublicKeyCredentialCreationOptions as JSON, compatible with PublicKeyCredential.parseCreationOptionsFromJSON().
  • Responses use CreateResponseDetails; success may include responseJson from PublicKeyCredential.toJSON().
  • Errors can carry DOMExceptionDetails.

Assertion side mirrors this with PublicKeyCredentialRequestOptions in requestDetailsJson and GetResponseDetails. IsUvpaaResponseDetails answers UV/PAA-style capability queries tied to a requestId.

Always correlate responses with the requestId from the incoming create/get request; mixing IDs across parallel operations breaks the proxy contract.

Offscreen documents: justification, reasons, and url

Section titled “Offscreen documents: justification, reasons, and url”

browser.offscreen creates a hidden document when the background context needs DOM APIs. Creation details include:

Property Purpose
justification Developer string explaining why the background needs this context; the user agent may show it.
reasons Array of Reason values declaring why the offscreen doc exists.
url Relative URL loaded in the document.

Offscreen pages are for capabilities you cannot hold in a service worker alone (playback, clipboard, some DOM work)—not a general substitute for a visible extension page.

DevTools: reading and editing inspected resources

Section titled “DevTools: reading and editing inspected resources”

On browser.devtools.inspectedWindow, resource entries expose url and:

  • getContent() — returns a Promise<object> when content is available (Chrome 151+ / browser.* since 152).
  • setContent(content, commit) — content is the new text; commit is true when editing is finished and content should persist, false for in-progress edits. Only text resources are supported today.

Use commit: false while the user types; a final commit: true avoids partial writes being treated as saves.

browser.desktopCapture and chrome.desktopCapture share the same ID pattern:

  • chooseDesktopMedia() yields a desktopMediaRequestId used when starting capture.
  • The API can return an id passed to cancelChooseDesktopMedia() if the picker must be dismissed programmatically.

Losing track of that cancel id leaves the media chooser open until the user closes it.

Input method editor: onKeyEvent and sendKeyEvents

Section titled “Input method editor: onKeyEvent and sendKeyEvents”

browser.input.ime (and chrome.input.ime) describe keyboard events with physical code, logical key, modifiers, and type (keydown / keyup). Reply with:

  • requestId — from keyEvent.requestId (not the deprecated property on the event object).
  • response — true if the extension handled the keystroke, false if not.

keyCode is documented as deprecated HTML keyCode; prefer code / key for new IME logic.

Embedded webview: permissionrequest handlers

Section titled “Embedded webview: permissionrequest handlers”

chrome.webviewTag (guest content inside an app-style embedder) surfaces many permission types—download, filesystem, fullscreen, geolocation, HID, media, pointer lock, plugins, and more. Request objects typically expose context (url, origin, requestMethod, etc.) and:

  • allow() — grant the capability (default for some types, e.g. load-plugin, unless you deny()).
  • deny() — reject; for several types this is the default if you never call allow().

Dialog helpers on the tag include ok(response?) and cancel() for guest alert / confirm / prompt. New-window requests can attach(webview) or discard().

Legacy Chrome Apps embedding (chrome.app.runtime / appview)

Section titled “Legacy Chrome Apps embedding (chrome.app.runtime / appview)”

chrome.app.runtime and chrome.appviewTag cover <appview> embedding: optional data, embedderId, and allow(url) / deny() for embedding decisions. Chrome Apps are deprecated; keep this only when maintaining legacy embedders.

  • Treating attemptsLeft on certificate PIN UI as enforced by the browser instead of calling stopPinRequest with MAX_ATTEMPTS_EXCEEDED.
  • Calling browser.permissions request without tabId or documentId, or with a non–top-level documentId.
  • Sending setContent with commit: true on every keystroke for DevTools overrides.
  • Answering webAuthenticationProxy with the wrong requestId under concurrent passkey operations.
  • Assuming browser.fontSettings details does something—it is explicitly unused.
  • For webview guests, forgetting that deny() is the default for several permission events when allow() is never invoked.
  1. Open chrome://extensions, enable Developer mode, and load your unpacked extension; confirm the manifest declares every API you call (permissions, certificateProvider, offscreen, etc.) per the matching reference page (start from browser.action and follow links to each API you use).
  2. In the service worker or background page console, log the full details / request object you pass into API methods and verify field names against the typedef on Chrome for Developers (for example browser.declarativeNetRequest for TestMatchRequestDetails).
  3. Trigger a host permission request with an explicit tabId or top-level documentId and pattern as documented on browser.permissions; navigate the tab to another origin and confirm the prompt is removed.
  4. For certificate or WebAuthn flows, run through PIN and passkey paths once with the extension’s service worker logging requestId / signRequestId pairing; compare behavior with browser.certificateProvider and browser.webAuthenticationProxy.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will fix or clarify it.