After restoring a session using -[WKWebView setInteractionState:], all loads within that WKWebView are marked as app-initiated, including back/forward navigation through the restored state, and tapping links. This continues until the next call to -[WKWebView loadRequest:]. This was fixed for Safari in bug 229721 by adding an |isAppInitiated| property to _WKSessionState, but other browsers on iOS still have the same issue since they can't use this SPI. So an equivalent public API way to restore a session but have loads marked as non-app-initiated is needed, perhaps adding an extra argument to -[WKWebView setInteractionState:]. I've also filed FB9728909 for this bug.
<rdar://problem/84811692>
Thanks for filing! We are looking into this.
Created attachment 442888 [details] Patch
Comment on attachment 442888 [details] Patch R=me
Committed r285080 (243722@main): <https://commits.webkit.org/243722@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 442888 [details].
Can we remove _WKSessionState.isAppInitiated now?
(In reply to Alex Christensen from comment #6) > Can we remove _WKSessionState.isAppInitiated now? Yes