<?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>282689</bug_id>
          
          <creation_ts>2024-11-06 06:45:56 -0800</creation_ts>
          <short_desc>[Navigation] Fix remaining problems with traversals</short_desc>
          <delta_ts>2024-12-20 16:13:04 -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>NEW</bug_status>
          <resolution></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>
          <dependson>284865</dependson>
    
    <dependson>285045</dependson>
          <blocked>258384</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Rob Buis">rbuis</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2073162</commentid>
    <comment_count>0</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-06 06:45:56 -0800</bug_when>
    <thetext>Fix remaining problems with traversals.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2073164</commentid>
    <comment_count>1</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-06 06:46:57 -0800</bug_when>
    <thetext>Traversal tests timing out:

navigation-methods/back-forward-multiple-frames.html
traverseTo-detach-between-navigate-and-navigatesucces.html
navigation-traverseTo-in-iframe-same-document-preventDefault.html
navigation-traverseTo-navigates-top-and-same-doc-child-and-cross-doc-child.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2073165</commentid>
    <comment_count>2</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2024-11-06 06:48:34 -0800</bug_when>
    <thetext>This will have to be debugged more closely to see what is the problem. I suspect that for at least for one of them the problem is not correctly cancelling navigation for both top and subframe.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2074792</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-13 06:46:13 -0800</bug_when>
    <thetext>&lt;rdar://problem/139799959&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080198</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-09 07:49:41 -0800</bug_when>
    <thetext>I started taking a look at navigation-methods/back-forward-multiple-frames.html.

At the following step: // Going back in top should go 3-&gt;1 (navigating both windows).
This resolves:
```
await navigation.back().commited;
```

but this doesn&apos;t:
```
new Promise(resolve =&gt; i.contentWindow.onpopstate = resolve)
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080199</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-09 08:18:21 -0800</bug_when>
    <thetext>navigation-methods/back-forward-multiple-frames.html has a top frame and an iframe.
The test does this:
1. Navigate the top frame to &quot;#top&quot;
2. Navigate the iframe to &quot;#iframe&quot;
3. Call `navigation.back()` in the top frame
4. Expects both the top frame and the iframe to get navigated back (so that the fragment is removed from both) and a popstate event to get fired in both frames.

This works in Blink but in WebKit, only the top frame gets navigated and gets a popstate event. The iframe is still sitting on &quot;#iframe&quot; after calling `navigation.back()` in the top frame.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080218</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-09 09:10:14 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #5)
&gt; navigation-methods/back-forward-multiple-frames.html has a top frame and an
&gt; iframe.
&gt; The test does this:
&gt; 1. Navigate the top frame to &quot;#top&quot;
&gt; 2. Navigate the iframe to &quot;#iframe&quot;
&gt; 3. Call `navigation.back()` in the top frame
&gt; 4. Expects both the top frame and the iframe to get navigated back (so that
&gt; the fragment is removed from both) and a popstate event to get fired in both
&gt; frames.
&gt; 
&gt; This works in Blink but in WebKit, only the top frame gets navigated and
&gt; gets a popstate event. The iframe is still sitting on &quot;#iframe&quot; after
&gt; calling `navigation.back()` in the top frame.

Looking at the `Navigation::back()` implementation, it does look like it doesn&apos;t quite match the specification and only navigates a single frame. In the spec, we&apos;re supposed to also navigate child frames if the navigation of the parent frame doesn&apos;t change document (i.e. just a fragment navigation).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080220</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-09 09:19:38 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #6)
&gt; (In reply to Chris Dumez from comment #5)
&gt; &gt; navigation-methods/back-forward-multiple-frames.html has a top frame and an
&gt; &gt; iframe.
&gt; &gt; The test does this:
&gt; &gt; 1. Navigate the top frame to &quot;#top&quot;
&gt; &gt; 2. Navigate the iframe to &quot;#iframe&quot;
&gt; &gt; 3. Call `navigation.back()` in the top frame
&gt; &gt; 4. Expects both the top frame and the iframe to get navigated back (so that
&gt; &gt; the fragment is removed from both) and a popstate event to get fired in both
&gt; &gt; frames.
&gt; &gt; 
&gt; &gt; This works in Blink but in WebKit, only the top frame gets navigated and
&gt; &gt; gets a popstate event. The iframe is still sitting on &quot;#iframe&quot; after
&gt; &gt; calling `navigation.back()` in the top frame.
&gt; 
&gt; Looking at the `Navigation::back()` implementation, it does look like it
&gt; doesn&apos;t quite match the specification and only navigates a single frame. In
&gt; the spec, we&apos;re supposed to also navigate child frames if the navigation of
&gt; the parent frame doesn&apos;t change document (i.e. just a fragment navigation).

Relevant spec: https://html.spec.whatwg.org/#getting-all-navigables-that-might-experience-a-cross-document-traversal</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080221</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-09 09:24:26 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #7)
&gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; (In reply to Chris Dumez from comment #5)
&gt; &gt; &gt; navigation-methods/back-forward-multiple-frames.html has a top frame and an
&gt; &gt; &gt; iframe.
&gt; &gt; &gt; The test does this:
&gt; &gt; &gt; 1. Navigate the top frame to &quot;#top&quot;
&gt; &gt; &gt; 2. Navigate the iframe to &quot;#iframe&quot;
&gt; &gt; &gt; 3. Call `navigation.back()` in the top frame
&gt; &gt; &gt; 4. Expects both the top frame and the iframe to get navigated back (so that
&gt; &gt; &gt; the fragment is removed from both) and a popstate event to get fired in both
&gt; &gt; &gt; frames.
&gt; &gt; &gt; 
&gt; &gt; &gt; This works in Blink but in WebKit, only the top frame gets navigated and
&gt; &gt; &gt; gets a popstate event. The iframe is still sitting on &quot;#iframe&quot; after
&gt; &gt; &gt; calling `navigation.back()` in the top frame.
&gt; &gt; 
&gt; &gt; Looking at the `Navigation::back()` implementation, it does look like it
&gt; &gt; doesn&apos;t quite match the specification and only navigates a single frame. In
&gt; &gt; the spec, we&apos;re supposed to also navigate child frames if the navigation of
&gt; &gt; the parent frame doesn&apos;t change document (i.e. just a fragment navigation).
&gt; 
&gt; Relevant spec:
&gt; https://html.spec.whatwg.org/#getting-all-navigables-that-might-experience-a-
&gt; cross-document-traversal

And https://html.spec.whatwg.org/#get-all-navigables-whose-current-session-history-entry-will-change-or-reload</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2083146</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-19 15:58:15 -0800</bug_when>
    <thetext>Still failing:
- imported/w3c/web-platform-tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html
- imported/w3c/web-platform-tests/navigation-api/navigate-event/navigation-traverseTo-in-iframe-same-document-preventDefault.html

Other failures have been addressed in the dependency Bug 284865.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2083409</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-20 15:13:49 -0800</bug_when>
    <thetext>Bug 285045 should take care of:
- imported/w3c/web-platform-tests/navigation-api/navigate-event/navigation-traverseTo-in-iframe-same-document-preventDefault.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2083423</commentid>
    <comment_count>11</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-20 15:51:49 -0800</bug_when>
    <thetext>Did some early investigation for imported/w3c/web-platform-tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html, it seems due to the following code in `FrameLoader::stopLoading()`:
```
        if (document-&gt;settings().navigationAPIEnabled() &amp;&amp; !m_doNotAbortNavigationAPI &amp;&amp; unloadEventPolicy != UnloadEventPolicy::UnloadAndPageHide) {
            RefPtr window = m_frame-&gt;document()-&gt;domWindow();
            window-&gt;protectedNavigation()-&gt;abortOngoingNavigationIfNeeded();
        }
```

If you comment out the `unloadEventPolicy != UnloadEventPolicy::UnloadAndPageHide` check then the test start passing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2083430</commentid>
    <comment_count>12</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-12-20 16:13:04 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #11)
&gt; Did some early investigation for
&gt; imported/w3c/web-platform-tests/navigation-api/navigation-methods/traverseTo-
&gt; detach-between-navigate-and-navigatesuccess.html, it seems due to the
&gt; following code in `FrameLoader::stopLoading()`:
&gt; ```
&gt;         if (document-&gt;settings().navigationAPIEnabled() &amp;&amp;
&gt; !m_doNotAbortNavigationAPI &amp;&amp; unloadEventPolicy !=
&gt; UnloadEventPolicy::UnloadAndPageHide) {
&gt;             RefPtr window = m_frame-&gt;document()-&gt;domWindow();
&gt;             window-&gt;protectedNavigation()-&gt;abortOngoingNavigationIfNeeded();
&gt;         }
&gt; ```
&gt; 
&gt; If you comment out the `unloadEventPolicy !=
&gt; UnloadEventPolicy::UnloadAndPageHide` check then the test start passing.

Making this change breaks a few tests though:
  imported/w3c/web-platform-tests/navigation-api/navigation-methods/navigate-history-push-same-url-cross-document.html [ Failure ]
  imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/traverseTo-detach-same-document-before-navigate-event.html [ Failure ]
  imported/w3c/web-platform-tests/navigation-api/ordering-and-transition/transition-cross-document.html [ Failure ]</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>