<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>223405</bug_id>
          
          <creation_ts>2021-03-17 17:33:33 -0700</creation_ts>
          <short_desc>[ITP] User initiated cross-domain link navigations getting counted as Top Frame Redirects</short_desc>
          <delta_ts>2023-01-02 11:33:48 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mathieu Perreault">mathieu.perreault</reporter>
          <assigned_to name="Charlie Wolfe">charliew</assigned_to>
          <cc>drexler.robin</cc>
    
    <cc>jon.burns</cc>
    
    <cc>mathieu.perreault</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1740968</commentid>
    <comment_count>0</comment_count>
    <who name="Mathieu Perreault">mathieu.perreault</who>
    <bug_when>2021-03-17 17:33:33 -0700</bug_when>
    <thetext>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 &lt;a&gt; 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 &lt; 5 seconds), one can see that TopFrameUniqueRedirectsTo table being updated for the navigation from B -&gt; A.
- If X &gt; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1740969</commentid>
    <comment_count>1</comment_count>
    <who name="Mathieu Perreault">mathieu.perreault</who>
    <bug_when>2021-03-17 17:34:57 -0700</bug_when>
    <thetext>Forgot to mention that the very simple demo that this is based on is at https://app.tornadored.com/oauth. Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1740975</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-17 17:41:39 -0700</bug_when>
    <thetext>&lt;rdar://problem/75552559&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1740976</commentid>
    <comment_count>3</comment_count>
    <who name="John Wilander">wilander</who>
    <bug_when>2021-03-17 17:42:01 -0700</bug_when>
    <thetext>Thanks for filing, Mathieu!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1911263</commentid>
    <comment_count>4</comment_count>
    <who name="Robin Drexler">drexler.robin</who>
    <bug_when>2022-11-09 08:28:04 -0800</bug_when>
    <thetext>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.

&gt; 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`.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1922292</commentid>
    <comment_count>5</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2022-12-30 12:46:36 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/8108</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1922549</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-01-02 11:33:46 -0800</bug_when>
    <thetext>Committed 258382@main (aee01bb955fb): &lt;https://commits.webkit.org/258382@main&gt;

Reviewed commits have been landed. Closing PR #8108 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>