Bug 232506

Summary: [iOS] Need API for marking file requests as non-app-initiated
Product: WebKit Reporter: Ali Juma <ajuma>
Component: Page LoadingAssignee: Kate Cheney <katherine_cheney>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, bfulgham, justincohen, katherine_cheney, rohitrao, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch none

Ali Juma
Reported Friday, October 29, 2021 10:40:00 PM UTC
Chrome for iOS uses a file-based session restoration approach for cases where [WKWebView setInteractionState:] cannot be used. These cases include syncing tabs across devices, reopening closed tabs (i.e., where the user closes a tab, but decides later that they want the tab back), and users upgrading from iOS 14. Network requests in such tabs should be marked as non-app-initiated, but there's currently no way to set request attribution for file requests. The result is that all back/forward and link-tap navigations in such tabs get marked as app-initiated, until the next call to [WKWebView loadRequest:] (in practice, this means that all navigation is marked as app-initiated until the next time the user types a URL in the URL bar instead of tapping on links). Specifically: 1) [WKWebView loadFileRequest:allowingReadAccessToURL:] only looks at the URL in the given request, and ignores everything else, including the request's |attribution| property. 2) [WKWebView loadFile:allowingReadAccessToURL:] doesn't have any way to set attribution.
Attachments
Patch (11.40 KB, patch)
2021-11-02 16:21 PDT, Kate Cheney
ews-feeder: commit-queue-
Patch (11.51 KB, patch)
2021-11-02 16:32 PDT, Kate Cheney
no flags
Radar WebKit Bug Importer
Comment 1 Friday, October 29, 2021 10:55:18 PM UTC
Brent Fulgham
Comment 2 Friday, October 29, 2021 11:05:09 PM UTC
This sounds like a bug: [WKWebView loadFileRequest:allowingReadAccessToURL:] The NSURLRequest passed to this load argument, along with the attribution for that request, should be honored by the system. Let me look into this.
Kate Cheney
Comment 3 Wednesday, November 3, 2021 12:21:19 AM UTC
Brent Fulgham
Comment 4 Wednesday, November 3, 2021 12:25:18 AM UTC
Comment on attachment 443142 [details] Patch r=me, though EWS might be having some issues.
Kate Cheney
Comment 5 Wednesday, November 3, 2021 12:32:03 AM UTC
Kate Cheney
Comment 6 Wednesday, November 3, 2021 12:32:27 AM UTC
Thanks! I think this patch should fix mac EWS, let's see...
EWS
Comment 7 Wednesday, November 3, 2021 5:17:28 PM UTC
Committed r285208 (243834@main): <https://commits.webkit.org/243834@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 443144 [details].
Note You need to log in before you can comment on or make changes to this bug.