<?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>282593</bug_id>
          
          <creation_ts>2024-11-05 01:37:19 -0800</creation_ts>
          <short_desc>[Navigation] Navigation.navigate() should trigger the &apos;beforeunload&apos; event synchronously</short_desc>
          <delta_ts>2024-12-19 10:54:03 -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>Page Loading</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>BrowserCompat, InRadar, WPTImpact</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>284637</dependson>
          <blocked>258384</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Rob Buis">rbuis</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2072752</commentid>
    <comment_count>0</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-05 01:37:19 -0800</bug_when>
    <thetext>Support beforeunload on subframes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2072756</commentid>
    <comment_count>1</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-05 01:42:38 -0800</bug_when>
    <thetext>This is blocking many navigation-api WPT tests, for example:
navigation-api/navigate-event/navigate-navigation-back-cross-document.html
navigation-api/navigation-methods/return-value/back-beforeunload.html
navigation-api/navigation-methods/return-value/forward-beforeunload.html
navigation-api/navigation-methods/return-value/navigate-beforeunload.html
navigation-api/navigation-methods/return-value/navigate-rejection-order-beforeunload-unserializablestate.html
navigation-api/navigation-methods/return-value/navigate-rejection-order-invalidurl-beforeunload.html
navigation-api/navigation-methods/return-value/reload-beforeunload.html
navigation-api/navigation-methods/return-value/reload-rejection-order-beforeunload-unserializablestate.html
navigation-api/navigation-methods/return-value/traverseTo-beforeunload.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2072934</commentid>
    <comment_count>2</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-05 13:19:05 -0800</bug_when>
    <thetext>Note that this is not just for the benefit of navigation api though, it should allow interoperability with Chrome and gecko too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2074205</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-10 22:06:02 -0800</bug_when>
    <thetext>&lt;rdar://problem/139628818&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075985</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-11-18 16:03:38 -0800</bug_when>
    <thetext>We do dispatch beforeunload in subframes. The issue is that the tests seem to expect the beforeunload event to get fired *synchronously* when calling `navigate()`. In WebKit, it gets called asynchronously since there is a navigation policy decision that happens before we navigate and this policy decision is normally async.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2076109</commentid>
    <comment_count>5</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-19 05:56:31 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #4)
&gt; We do dispatch beforeunload in subframes. The issue is that the tests seem
&gt; to expect the beforeunload event to get fired *synchronously* when calling
&gt; `navigate()`. In WebKit, it gets called asynchronously since there is a
&gt; navigation policy decision that happens before we navigate and this policy
&gt; decision is normally async.

Thanks Chris, I renamed the bug so it reflects it is a problem with Navigation API + beforeunload on subframes, not beforeunload on subframes by itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2076133</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-11-19 07:47:41 -0800</bug_when>
    <thetext>BTW, I tried making the policy decision synchronous but it caused other issues. If the navigation happens synchronously, then it ends up canceling the *current* navigation (triggered by Navigation API) and we fire the navigateerror event. This doesn&apos;t happen when the navigation happens asynchronously.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2076508</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-11-20 14:00:32 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/36915</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2076766</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-11-21 11:48:22 -0800</bug_when>
    <thetext>Committed 286919@main (4c2147c4b2aa): &lt;https://commits.webkit.org/286919@main&gt;

Reviewed commits have been landed. Closing PR #36915 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2081582</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-13 12:01:55 -0800</bug_when>
    <thetext>Re-opening since the patch got reverted because of a Speedometer regression.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2082071</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-16 10:07:03 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/38019</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2083059</commentid>
    <comment_count>11</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-12-19 10:54:01 -0800</bug_when>
    <thetext>Committed 288106@main (9fb3593f38c1): &lt;https://commits.webkit.org/288106@main&gt;

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

    </bug>

</bugzilla>