Bug 232506 - [iOS] Need API for marking file requests as non-app-initiated
Summary: [iOS] Need API for marking file requests as non-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 14:40 PDT by Ali Juma
Modified: 2021-11-03 09:17 PDT (History)
7 users (show)

See Also:


Attachments
Patch (11.40 KB, patch)
2021-11-02 16:21 PDT, Kate Cheney
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (11.51 KB, patch)
2021-11-02 16:32 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 14:40:00 PDT
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.
Comment 1 Radar WebKit Bug Importer 2021-10-29 14:55:18 PDT
<rdar://problem/84824703>
Comment 2 Brent Fulgham 2021-10-29 15:05:09 PDT
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.
Comment 3 Kate Cheney 2021-11-02 16:21:19 PDT
Created attachment 443142 [details]
Patch
Comment 4 Brent Fulgham 2021-11-02 16:25:18 PDT
Comment on attachment 443142 [details]
Patch

r=me, though EWS might be having some issues.
Comment 5 Kate Cheney 2021-11-02 16:32:03 PDT
Created attachment 443144 [details]
Patch
Comment 6 Kate Cheney 2021-11-02 16:32:27 PDT
Thanks! I think this patch should fix mac EWS, let's see...
Comment 7 EWS 2021-11-03 09:17:28 PDT
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].