Bug 315104
| Summary: | [Site Isolation] Decouple BFCache entry lifecycle from frame state side-channel via explicit IPCs | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Basuke Suzuki <basuke> |
| Component: | WebKit2 | Assignee: | 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
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Basuke Suzuki
<rdar://problem/177439386>
Basuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/65243
EWS
Committed 313625@main (b776e22550fb): <https://commits.webkit.org/313625@main>
Reviewed commits have been landed. Closing PR #65243 and removing active labels.