<?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>300402</bug_id>
          
          <creation_ts>2025-10-08 12:35:33 -0700</creation_ts>
          <short_desc>REGRESSION: Crash in Navigation::initializeForNewWindow</short_desc>
          <delta_ts>2025-10-30 10:08:44 -0700</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>All</rep_platform>
          <op_sys>All</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>301593</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yury Semikhatsky">yurys</reporter>
          <assigned_to name="Diego Pino">dpino</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>charliew</cc>
    
    <cc>dpino</cc>
    
    <cc>rupin</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2149521</commentid>
    <comment_count>0</comment_count>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2025-10-08 12:35:33 -0700</bug_when>
    <thetext>After rolling WebKit with https://commits.webkit.org/299927@main and https://commits.webkit.org/299858@main into Playwright we see the following crash when page is reloaded:</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2149522</commentid>
    <comment_count>1</comment_count>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2025-10-08 12:36:10 -0700</bug_when>
    <thetext>* thread #1, name = &apos;WebKitWebProces&apos;, stop reason = signal SIGABRT
  * frame #0: 0x00007f09b86969fc libc.so.6`__GI___pthread_kill [inlined] __pthread_kill_implementation(no_tid=0, signo=6, threadid=139679660424064) at pthread_kill.c:44:76
    frame #1: 0x00007f09b86969b0 libc.so.6`__GI___pthread_kill [inlined] __pthread_kill_internal(signo=6, threadid=139679660424064) at pthread_kill.c:78:10
    frame #2: 0x00007f09b86969b0 libc.so.6`__GI___pthread_kill(threadid=139679660424064, signo=6) at pthread_kill.c:89:10
    frame #3: 0x00007f09b8642476 libc.so.6`__GI_raise(sig=6) at raise.c:26:13
    frame #4: 0x00007f09b86287f3 libc.so.6`__GI_abort at abort.c:79:7
    frame #5: 0x00007f09b8ad836f libstdc++.so.6`std::__glibcxx_assert_fail(char const*, int, char const*, char const*) + 111
    frame #6: 0x00007f09c13b0bb2 libwebkitgtk-6.0.so.4`WebCore::Navigation::initializeForNewWindow(std::optional&lt;WebCore::NavigationNavigationType&gt;, WebCore::LocalDOMWindow*) + 1890
    frame #7: 0x00007f09c123faaf libwebkitgtk-6.0.so.4`WebCore::FrameLoader::didBeginDocument(bool, WebCore::LocalDOMWindow*) + 2751
    frame #8: 0x00007f09c121e5a8 libwebkitgtk-6.0.so.4`WebCore::DocumentWriter::begin(WTF::URL const&amp;, bool, WebCore::Document*, std::optional&lt;WebCore::ProcessQualified&lt;WTF::UUID&gt;&gt;, WebCore::NavigationAction const*) + 2552
    frame #9: 0x00007f09c1215bb9 libwebkitgtk-6.0.so.4`WebCore::DocumentLoader::commitData(WebCore::SharedBuffer const&amp;) + 297
    frame #10: 0x00007f09bf7b43c8 libwebkitgtk-6.0.so.4`WebKit::WebLocalFrameLoaderClient::committedLoad(WebCore::DocumentLoader*, WebCore::SharedBuffer const&amp;) + 24
    frame #11: 0x00007f09c121da89 libwebkitgtk-6.0.so.4`WebCore::DocumentLoader::commitLoad(WebCore::SharedBuffer const&amp;) + 281
    frame #12: 0x00007f09c12bdb6f libwebkitgtk-6.0.so.4`WebCore::CachedRawResource::notifyClientsDataWasReceived(WebCore::SharedBuffer const&amp;) + 223
    frame #13: 0x00007f09c12bd7a6 libwebkitgtk-6.0.so.4`WebCore::CachedRawResource::updateBuffer(WebCore::FragmentedSharedBuffer const&amp;) + 390
    frame #14: 0x00007f09c12a22ce libwebkitgtk-6.0.so.4`WebCore::SubresourceLoader::didReceiveBuffer(WebCore::FragmentedSharedBuffer const&amp;, long long, WebCore::DataPayloadType) + 174
    frame #15: 0x00007f09bf727edb libwebkitgtk-6.0.so.4`WebKit::WebResourceLoader::didReceiveData(IPC::SharedBufferReference&amp;&amp;, unsigned long) + 379
    frame #16: 0x00007f09beed9a4e libwebkitgtk-6.0.so.4`WebKit::WebResourceLoader::didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;) + 142
    frame #17: 0x00007f09bf7163d6 libwebkitgtk-6.0.so.4`WebKit::NetworkProcessConnection::dispatchMessage(IPC::Connection&amp;, IPC::Decoder&amp;) + 646
    frame #18: 0x00007f09beed82be libwebkitgtk-6.0.so.4`WebKit::NetworkProcessConnection::didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;) + 574
    frame #19: 0x00007f09bf2f983e libwebkitgtk-6.0.so.4`IPC::Connection::dispatchMessage(IPC::Decoder&amp;) + 94
    frame #20: 0x00007f09bf2f9b25 libwebkitgtk-6.0.so.4`IPC::Connection::dispatchMessage(WTF::UniqueRef&lt;IPC::Decoder&gt;) + 277
    frame #21: 0x00007f09bf2f9c61 libwebkitgtk-6.0.so.4`IPC::Connection::dispatchOneIncomingMessage() + 161
    frame #22: 0x00007f09bcab2445 libjavascriptcoregtk-6.0.so.1`WTF::RunLoop::performWork() + 549
    frame #23: 0x00007f09bcb6ef26 libjavascriptcoregtk-6.0.so.1`WTF::RunLoop::RunLoop()::$_0::__invoke(void*) + 6
    frame #24: 0x00007f09bcb6e28a libjavascriptcoregtk-6.0.so.1`WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) + 74
    frame #25: 0x00007f09bd1f3c44 libglib-2.0.so.0`g_main_context_dispatch + 372
    frame #26: 0x00007f09bd2492b8 libglib-2.0.so.0`___lldb_unnamed_symbol2709 + 488
    frame #27: 0x00007f09bd1f32b3 libglib-2.0.so.0`g_main_loop_run + 115
    frame #28: 0x00007f09bcb6e7b3 libjavascriptcoregtk-6.0.so.1`WTF::RunLoop::run() + 243
    frame #29: 0x00007f09bf84ea23 libwebkitgtk-6.0.so.4`WebKit::WebProcessMain(int, char**) + 179
    frame #30: 0x00007f09b8629d90 libc.so.6`__libc_start_call_main(main=(WebKitWebProcess`main), argc=3, argv=0x00007fff6bb60218) at libc_start_call_main.h:58:16
    frame #31: 0x00007f09b8629e40 libc.so.6`__libc_start_main_impl(main=(WebKitWebProcess`main), argc=3, argv=0x00007fff6bb60218, init=&lt;unavailable&gt;, fini=&lt;unavailable&gt;, rtld_fini=&lt;unavailable&gt;, stack_end=0x00007fff6bb60208) at libc-start.c:392:3
    frame #32: 0x000056a784adf075 WebKitWebProcess`_start + 37

It happens because previousNavigation-&gt;m_currentEntryIndex is a nullopt at this line https://github.com/WebKit/WebKit/blob/75aed5e343cdfbd4713ff3267d7476a9b884648c/Source/WebCore/page/Navigation.cpp#L145</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2149523</commentid>
    <comment_count>2</comment_count>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2025-10-08 12:37:25 -0700</bug_when>
    <thetext>Original report https://github.com/microsoft/playwright/issues/37766, can be reproduced with the following playwright test: https://gist.github.com/mirao/707670c2378576f940c518b6e85b0794 (I&apos;m getting 403 Forbidden when trying to add its code to this bug inline).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2149550</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-10-08 14:00:01 -0700</bug_when>
    <thetext>&lt;rdar://problem/162229228&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2149637</commentid>
    <comment_count>4</comment_count>
    <who name="Diego Pino">dpino</who>
    <bug_when>2025-10-08 22:34:47 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/52049</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>