This document explains how component extensions opt into Back/Forward Cache (BFCache) support for embedded extension frames (<iframe> elements) and the behavioral consequences of opting in.
By default, embedding an extension subframe (<iframe src="chrome-extension://...">) in a web page blocks the main page from entering BFCache. Top-level chrome-extension:// main frames are also not eligible for BFCache (which only caches HTTP/HTTPS main frames); by contrast, web pages with injected extension content scripts are cached by default.
The default restriction on extension subframes exists for two reasons:
WindowAgent sharing: By default, all same-origin extension frames in a renderer process share a single WindowAgent and event loop across all tabs in a given profile. When a tab enters BFCache, Blink pauses microtasks on its event loop. If a cached extension subframe shared that event loop with an active foreground tab or side panel, pausing the cached tab would freeze microtask execution across active extension contexts as well (because of this, extension subframes were blocked from entering BFCache in crrev.com/c/7774414).Component extensions that embed subframes into web pages can opt into BFCache support via the "back_forward_cache" manifest key:
{ "name": "Example Component Extension", "manifest_version": 3, "back_forward_cache": { "supported": true } }
NOTE: This opt-in is currently restricted to component extensions (and gated by the BackForwardCacheForComponentExtensionFrames feature flag) during initial development and vetting. If support is expanded to third-party extensions in the future, the behavioral differences below describe the contract extension frames operate under when opted in.
BrowsingInstance WindowAgent isolationPer the HTML specification, mutually reachable same-origin Window objects share a WindowAgent so that synchronous cross-window scripting shares a single event loop (including the microtask queue, MutationObserver delivery, Custom Element reactions, and IndexedDB transaction cleanup) and agent cluster ID. Because extension views across unrelated tabs can synchronously script each other (for example, via chrome.extension.getViews() or named frame lookup), extensions normally share a single WindowAgent across the entire renderer process.
When an extension opts into BFCache, each BrowsingInstance (such as an independent tab or side panel) is allocated its own WindowAgent and event loop. Frames within the same tab, or windows linked via window.open(), still share a BrowsingInstance and therefore share a WindowAgent.
Isolating the WindowAgent per BrowsingInstance has the following behavioral consequences across unrelated tabs:
| Capability | Default extension behavior | BFCache opted-in behavior |
|---|---|---|
| Microtask pausing on BFCache entry | Pausing one tab's event loop pauses microtasks across all same-process tabs and side panels. | Pausing a cached tab's event loop only affects that BrowsingInstance; active tabs and side panels continue running microtasks normally. |
Synchronous cross-view DOM access (getViews(), named frames) | Allowed across all same-process views. | Still allowed. Cross-BrowsingInstance access continues to work, though synchronous calls from View A into View B enqueue microtasks and DOM reactions on View B's queue rather than a single shared queue. |
Agent-cluster-locked postMessage payloads | Transferable across unrelated tabs because all views share an agent cluster ID. | Blocked across unrelated tabs. Objects locked to an agent cluster (SharedArrayBuffer, WebAssembly.Module, transferable RTCDataChannel, MediaSourceHandle, and WebCodecs AudioData/VideoFrame) cannot be sent via BroadcastChannel or MessagePort between unrelated tabs (messageerror is fired, matching Manifest V3 service worker behavior). |
| Main thread execution | Shared across all same-process main-thread extension contexts (frames and views; service workers and other workers run on separate worker threads). | Still shared. Separate event loops isolate microtask queues, but all same-process main-thread extension contexts still share the renderer main thread. Synchronous JavaScript or thread-blocking calls like window.alert() still block other main-thread extension contexts in that process. |
Opening related windows (window.open(), chrome.windows.create()) | Shares the process-wide WindowAgent. | Opening a window in a new BrowsingInstance (such as chrome.windows.create() with default options) allocates a separate WindowAgent and leaves the opener tab eligible for BFCache. Passing setSelfAsOpener: true or calling window.open() shares the opener's BrowsingInstance and blocks BFCache while the related window remains open. |
Additionally, chrome.extension.getViews() only returns top-level extension main frames. Because BFCache only caches HTTP/HTTPS main frames and never caches top-level chrome-extension:// tabs, getViews() never returns a BFCached extension frame.
While a page containing an opted-in extension subframe is in BFCache, extension API events (chrome.<api>.on*, such as chrome.tabs.onCreated or chrome.storage.onChanged) targeted at that cached extension frame are dropped:
pageshow with event.persisted === true), it may have missed events fired while it was cached.chrome-extension:// documents). For content scripts (kContentScript / kUserScript), extension API events such as chrome.storage.onChanged are queued by Blink's PausableScriptExecutor while the host page is frozen (without running JS or evicting the page) and fire if the page is restored from BFCache.chrome.runtime.Port lifecycleExtension messaging APIs (chrome.runtime.connect(), chrome.runtime.sendMessage(), and chrome.tabs.connect()) behave as follows with BFCache:
chrome.runtime.Port channels associated with frames under that page. The other endpoint (such as the extension service worker) receives an onDisconnect event indicating that the page moved into BFCache.Port objects cannot be reopened and are not automatically reconnected when the page is restored; frames that need a persistent channel after restoration must open a new port (for example, calling chrome.runtime.connect() on pageshow when event.persisted is true).If an opted-in extension is unloaded, disabled, or reloaded while a web page hosting one of its subframes is in BFCache, the browser evicts the cached page and destroys the extension frame rather than restoring a page with a defunct extension subframe.
<iframe> in pagehide instead of opting in?Removing an <iframe> or navigating it to about:blank inside a pagehide listener does not make the page eligible for BFCache:
kExtensionFrame disablement reason on the extension subframe's RenderFrameHost as soon as the subframe is registered, and that reason persists across same-RenderFrameHost navigations (such as navigating to about:blank).RenderFrameHosts in the frame tree before renderer pagehide DOM mutations (such as frame detach) are processed.pagehide runs after the browser has already placed the page into BFCache, causing the browser to evict the cached page (kDetach, kBeginNavigation, or kDidCommitNavigation).