Bug 223405 - [ITP] User initiated cross-domain link navigations getting counted as Top Frame Redirects
Summary: [ITP] User initiated cross-domain link navigations getting counted as Top Fra...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Charlie Wolfe
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-17 17:33 PDT by Mathieu Perreault
Modified: 2023-01-02 11:33 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Perreault 2021-03-17 17:33:33 PDT
The report is about user-initiated cross-domain link navigations that are sometimes counted as top frame redirects in the eyes of ITP.

Details
=======
The demo is two domains A and B linking to each other through <a> tags.

The interaction is starting at A, clicking on a link to navigate to B, waiting X seconds and clicking to go back to A.

- If the operation is done fast (X < 5 seconds), one can see that TopFrameUniqueRedirectsTo table being updated for the navigation from B -> A.
- If X > 5s before clicking to navigate back to A, there is no TopFrameUniqueRedirectsTo table entry.

The `ITPDebug` log doesn’t show this interaction, so that’s why we need to look in the sqlite database. 

As far as one can tell, [this](https://github.com/WebKit/WebKit/blob/main/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp#L1567) is the logic in the WebKit code. Given that there are no `ITPDebug` statement, one can infer that `wasNavigatedAfterShortDelayWithoutUserInteraction` is probably `true`, but in this case there _was_ a user interaction so that seems incorrect. Since it’s derived from a value passed from the UI Process, it’s impossible to confirm that by code inspection though.

Videos
======
https://screenshot.click/github_and_back_fast.mov
https://screenshot.click/github_and_back_slow.mov
Comment 1 Mathieu Perreault 2021-03-17 17:34:57 PDT
Forgot to mention that the very simple demo that this is based on is at https://app.tornadored.com/oauth. Thank you!
Comment 2 Radar WebKit Bug Importer 2021-03-17 17:41:39 PDT
<rdar://problem/75552559>
Comment 3 John Wilander 2021-03-17 17:42:01 PDT
Thanks for filing, Mathieu!
Comment 4 Robin Drexler 2022-11-09 08:28:04 PST
The initial bug report description makes it seem like user initiated navigations are only counted as redirects if a user navigates back and forth between two domains.

> The interaction is starting at A, clicking on a link to navigate to B, waiting X seconds and clicking to go back to A.


However, this behavior also occurs if you click on any outgoing cross-domain link too quickly. Which likely flags a lot of pages unnecessarily as prevalent. 

E.g. if you go to https://robin-test-1.account.myshopify.com/login?return_to=%2F and click on the `Continue` button in under 5 seconds, an entry to the `TopFrameUniqueRedirectsTo` table will be added for `account.myshopify.com`.
Comment 5 Charlie Wolfe 2022-12-30 12:46:36 PST
Pull request: https://github.com/WebKit/WebKit/pull/8108
Comment 6 EWS 2023-01-02 11:33:46 PST
Committed 258382@main (aee01bb955fb): <https://commits.webkit.org/258382@main>

Reviewed commits have been landed. Closing PR #8108 and removing active labels.