Skip to content
AnswerWell geo Documentation

Research · 6 min read · Answerwell

Extension browser Namespace, Adoption and Async Messaging

How the browser namespace relates to chrome in extensions, when to adopt it, polyfill pitfalls, and Promise-based onMessage from Chrome 148.

This page summarizes Chrome Extensions documentation on the cross-browser browser namespace, how it maps to the long-standing chrome namespace, practical adoption paths for new and existing extensions, and related messaging changes that shipped together in Chrome 148. Peripheral API reference pages in the same documentation set mostly record per-method Chrome version gates; the architectural story lives in the browser namespace concept guide and DevTools extension notes.

browser namespace: what it is and where it works

Section titled “browser namespace: what it is and where it works”

From Chrome 148, every Chrome Extension API is exposed under browser as well as under chrome. The two entry points are aliases: the same objects, callable from service workers, content scripts, and offscreen documents.

From Chrome 148, all Chrome Extension APIs are available under the browser namespace in addition to the existing chrome namespace. For example, browser.tabs.create() and chrome.tabs.create() are equivalent.

— Google Chrome, Transition to browser namespace

The namespace is available wherever you can call extension APIs, including content scripts, service workers, and offscreen documents. It points to the same API objects as chrome, so chrome.tabs === browser.tabs.

— Google Chrome, Transition to browser namespace

The browser name comes from work in the WebExtensions Community Group (WECC/WECG), where vendors align on shared extension standards. Google states that chrome is not being removed; both namespaces are expected to keep working.

When to adopt browser vs keep chrome: minimum version and runtime guard

Section titled “When to adopt browser vs keep chrome: minimum version and runtime guard”

If you are starting a new extension and can require a recent Chrome, the documentation’s shortest path is to set minimum_chrome_version to "148" and call browser.* everywhere with no runtime branch.

If you’re building a new extension, set minimum_chrome_version to “148” and use browser unconditionally; you can stop reading here.

— Google Chrome, Transition to browser namespace

Raising minimum_chrome_version is a distribution decision, not a cosmetic manifest field. Chrome Web Store will not deliver newer extension packages to users below that version—they stay on the last build they received until they upgrade the browser.

Setting minimum_chrome_version stops all updates for users on older Chrome. The Chrome Web Store won’t deliver any future version of your extension to users below the version you specify - they remain frozen at whatever version they have installed, and won’t receive bug fixes, security patches, or new features unless they update Chrome.

— Google Chrome, Transition to browser namespace

For extensions that must support Chrome versions before 148, the documented pattern is an early startup alias so the rest of the codebase can use browser unconditionally:

if (!globalThis.browser) {
globalThis.browser = chrome;
}

Place that snippet before any other browser reference, as described in Transition to browser namespace. Google suggests optionally logging how often users hit the fallback path.

webextension-polyfill: why Chrome 148 shipped namespace and Promises together

Section titled “webextension-polyfill: why Chrome 148 shipped namespace and Promises together”

Extensions that depend on webextension-polyfill need a different plan than greenfield projects.

If your extension uses webextension-polyfill, it becomes a no-op on Chrome 148 and later. The polyfill skipped wrapping when browser was already defined, assuming the host browser had already provided the API.

— Google Chrome, Transition to browser namespace

An earlier attempt to expose browser in Chrome 136 was rolled back because the polyfill stopped wrapping while browser.runtime.onMessage still lacked native promise-returning listeners—extensions that relied on the polyfill for async replies broke. Chrome 148 ships the namespace and native Promise support for onMessage in the same release to close that gap.

Once your users are on Chrome 148+, you can drop the polyfill dependency according to Transition to browser namespace.

runtime.onMessage: Promise responses vs return true

Section titled “runtime.onMessage: Promise responses vs return true”

Chrome 148 adds a second async pattern for message passing, whether you call APIs as chrome.* or browser.*.

Previously, listeners had to return literal true and invoke sendResponse later. Now a listener may return a Promise (or be an async function) and resolve with the reply payload. The old pattern remains valid, so existing extensions do not have to rewrite message handlers immediately.

The concept page shows both patterns side by side in Transition to browser namespace. The important limit: Promise-returning runtime.onMessage listeners are not available for extensions that declare a devtools_page, for the same class of DevTools-related restrictions discussed below.

DevTools extensions: browser namespace disabled until Chrome 152

Section titled “DevTools extensions: browser namespace disabled until Chrome 152”

If your manifest includes devtools_page, historical behavior blocked browser for the entire extension—not only inside DevTools—because DevTools APIs were callback-only and conflicted with webextension-polyfill assumptions.

In Chrome versions older than 152, the browser namespace was turned off for extensions that declare devtools_page. The opt-out applied to the entire extension—not just the DevTools page, but every script context where extension APIs run.

— Google Chrome, Extend DevTools

From Chrome 152, extensions with a DevTools page may use browser again; DevTools APIs gained native Promise support in later milestones (for example chrome.devtools.inspectedWindow.eval() returning promises from Chrome 149, noted in What’s new in Chrome extensions).

How API availability lines are documented (browser.* since Chrome 148)

Section titled “How API availability lines are documented (browser.* since Chrome 148)”

Most extension API reference pages in this cluster follow a repeated template: a method or type lists the Chrome version in which it first appeared, plus a shorthand such as “browser.* since Chrome 148” meaning the symbol is reachable through the browser namespace once the host is 148+. Examples span browser.action, browser.storage, browser.declarativeNetRequest, and dozens of others.

That pattern does not replace reading each API’s own permissions, MV3 requirements, and platform limits. Some APIs are ChromeOS-only, policy-gated, or MV3-only regardless of namespace—for instance browser.offscreen availability notes MV3+, and enterprise login APIs document ChromeOS-only policy requirements on their reference pages.

Feature detection when behavior differs by version

Section titled “Feature detection when behavior differs by version”

Namespace aliasing does not mean every optional API exists on every Chrome build. Two documented patterns from the cluster:

User Scripts API — Google recommends probing by calling a method that throws when the API or permission is missing:

function isUserScriptsAvailable() {
try {
browser.userScripts.getScripts();
return true;
} catch {
return false;
}
}

See browser.userScripts.

MIME handler registration — Before Chrome 151, an extension could install but browser.mimeHandler stays undefined unless the handler is registered. Migration code can branch to network interception fallback:

if (browser.mimeHandler) {
// Chrome routes registered MIME types to the handler page
} else {
// Fall back to network request interception.
}

See browser.mimeHandler.

Offscreen documents before runtime.getContexts() — Chrome 116 added runtime.getContexts(). Earlier versions need clients.matchAll() to detect an existing offscreen document, as shown in browser.offscreen.

These checks are independent of browser vs chrome; they guard feature and permission availability.

  • Assuming browser implies cross-browser portability. The namespace aligns naming with the WebExtensions spec on Chrome; Firefox and other browsers have their own support matrices. Test target browsers explicitly.
  • Enabling browser on DevTools extensions before Chrome 152 without keeping chrome or polyfill paths for production users.
  • Removing webextension-polyfill before users reach Chrome 148, leaving async onMessage without native Promise listeners.
  • Setting minimum_chrome_version casually, freezing outdated extension builds for users who cannot upgrade Chrome quickly.
  • Ignoring API-specific false negatives — e.g. browser.action.isEnabled() returns false for actions enabled only via declarativeContent (browser.action).
  1. Confirm test Chrome is 148+ (152+ if the extension declares devtools_page). The browser namespace guide is the source of truth for namespace timing; release milestones are also listed in What’s new in Chrome extensions.

  2. Load the unpacked extension and in the service worker console verify browser.tabs === chrome.tabs (or another API surface you use), matching the equivalence statement in Transition to browser namespace.

  3. Exercise an async runtime.onMessage handler that returns a Promise and confirm the sender receives the resolved payload without return true / sendResponse, per Transition to browser namespace.

  4. If you use optional APIs, run the relevant feature probe (for example userScripts or mimeHandler patterns) on your minimum supported Chrome versions.

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

If something on this page disagrees with your reading of the linked Chrome documentation, email yimasynthetic@gmail.com with the page URL and the exact sentence you believe is wrong or unclear.