Bug 315104

Summary: [Site Isolation] Decouple BFCache entry lifecycle from frame state side-channel via explicit IPCs
Product: WebKit Reporter: Basuke Suzuki <basuke>
Component: WebKit2Assignee: Basuke Suzuki <basuke>
Status: RESOLVED FIXED    
Severity: Normal CC: kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Basuke Suzuki
Reported 2026-05-19 09:21:21 PDT
WebBackForwardCacheEntry creation and removal on UIProcess is currently driven implicitly by the hasCachedPage flag relayed through BackForwardUpdateItem (HistoryItem::notifyChanged → WebHistoryItemClient::historyItemChanged). The WebBackForwardList::backForwardUpdateItem handler observes the diff and creates / removes the entry as a side effect of frame state sync. This side-channel coupling has two problems: (1) the relay carries cache lifecycle state on a wire intended for frame state (URL, scroll position, etc.); (2) the timing of the implicit IPC interleaves with other lifecycle messages in ways that are hard to reason about and have produced ordering hazards. Replace the implicit hasCachedPage diff with explicit IPCs: - DidCacheItem(itemID): WP→UI, fired when BackForwardCache::addIfCacheable succeeds. - DidEvictCachedItem(itemID): WP→UI, fired when BackForwardCache::remove evicts an entry. - DidRestoreFromBackForwardCache(itemID): WP→UI, fired after cachedPage->restore() reinstalls the cached Document. Under Site Isolation with multi-process BFCache enabled, FrameLoader::commitProvisionalLoad uses the frameItemID overloads of addIfCacheable / take to bypass HistoryItem::notifyChanged so the cache lifecycle stays off the implicit relay. Non-SI paths continue to call notifyChanged but UIProcess no longer consults the hasCachedPage flag for cache lifecycle decisions. Foundational refactor for the broader same-site BFCache + cross-site iframe enable. The cross-site iframe BFCache feature itself is NOT enabled by this change — it remains gated until the iframe orchestration foundations and feature enable PRs land. No behavior change. Existing tests must continue to pass. rdar://177439788
Attachments
Basuke Suzuki
Comment 1 2026-05-19 17:29:47 PDT
Basuke Suzuki
Comment 2 2026-05-19 17:30:04 PDT
EWS
Comment 3 2026-05-20 19:12:06 PDT
Committed 313625@main (b776e22550fb): <https://commits.webkit.org/313625@main> Reviewed commits have been landed. Closing PR #65243 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.