Bug 232486 - [iOS 15] Loads after WKWebView session restore are marked as app-initiated
Summary: [iOS 15] Loads after WKWebView session restore are marked as app-initiated
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-29 08:36 PDT by Ali Juma
Modified: 2021-11-01 08:58 PDT (History)
8 users (show)

See Also:


Attachments
Patch (7.16 KB, patch)
2021-10-29 17:43 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Juma 2021-10-29 08:36:36 PDT
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.
Comment 1 Radar WebKit Bug Importer 2021-10-29 09:45:29 PDT
<rdar://problem/84811692>
Comment 2 Kate Cheney 2021-10-29 11:35:38 PDT
Thanks for filing! We are looking into this.
Comment 3 Kate Cheney 2021-10-29 17:43:05 PDT
Created attachment 442888 [details]
Patch
Comment 4 Brent Fulgham 2021-10-29 18:53:27 PDT
Comment on attachment 442888 [details]
Patch

R=me
Comment 5 EWS 2021-10-30 09:08:24 PDT
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].
Comment 6 Alex Christensen 2021-10-30 09:26:19 PDT
Can we remove _WKSessionState.isAppInitiated now?
Comment 7 Kate Cheney 2021-11-01 08:58:40 PDT
(In reply to Alex Christensen from comment #6)
> Can we remove _WKSessionState.isAppInitiated now?

Yes