<?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>310676</bug_id>
          
          <creation_ts>2026-03-24 16:46:39 -0700</creation_ts>
          <short_desc>[Site Isolation] Inconsistent console message ordering for tests which use Document::printNavigationErrorMessage compared to before Site Isolation</short_desc>
          <delta_ts>2026-03-25 16:15:58 -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>New Bugs</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="Anthony Tarbinian">a.tarbinian</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2193323</commentid>
    <comment_count>0</comment_count>
    <who name="Anthony Tarbinian">a.tarbinian</who>
    <bug_when>2026-03-24 16:46:39 -0700</bug_when>
    <thetext>Tests which trigger Document::printNavigationErrorMessage will print out certain console log messages differently to their -expected.txt when run with Site Isolation enabled vs disabled.

This is due to the fact that printNavigationErrorMessage calls frame.documentURLForConsoleLog. If frame is a LocalFrame, it will grab the document URL synchronously from document-&gt;url(). However, if frame is a RemoteFrame an asynchronous IPC call is sent to retrieve the URL.

This difference in timing reveals itself in some tests which include the separate JS Exception which gets thrown in their -expected.txt file. With site isolation enabled, the message from printNavigationErrorMessage gets printed out at a later time than without site isolation. This allows the JS Exception to get printed before and cause a text diff -&gt; test failure. 

See this -expected.txt for example: https://github.com/WebKit/WebKit/blob/875e3a58a1b2889a8cf92d13a650be5c652e0d0c/LayoutTests/http/tests/security/block-top-level-navigation-to-different-scheme-by-third-party-iframes-expected.txt#L3-L4

This is what it looks like pre Site Isolation
```
CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL &apos;http://127.0.0.1:8000/security/block-top-level-navigation-to-different-scheme-by-third-party-iframes.html&apos; from frame with URL &apos;http://localhost:8000/security/resources/navigate-top-level-frame-to-failure-page-different-scheme.html&apos;. The frame attempting navigation of the top-level window is cross-origin or untrusted and the user has never interacted with the frame.

CONSOLE MESSAGE: SecurityError: The operation is insecure.
CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL &apos;http://127.0.0.1:8000/security/block-top-level-navigation-to-different-scheme-by-third-party-iframes.html&apos; from frame with URL &apos;http://localhost:8000/security/resources/navigate-top-level-frame-to-failure-page-different-scheme.html&apos;. The frame attempting navigation of the top-level window is cross-origin or untrusted and the user has never interacted with the frame.

CONSOLE MESSAGE: SecurityError: The operation is insecure.
```

This is what is printed with Site Isolation
```
CONSOLE MESSAGE: SecurityError: The operation is insecure.
CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL &apos;http://127.0.0.1:8000/security/block-top-level-navigation-to-different-scheme-by-third-party-iframes.html&apos; from frame with URL &apos;http://localhost:8000/security/resources/navigate-top-level-frame-to-failure-page-different-scheme.html&apos;. The frame attempting navigation of the top-level window is cross-origin or untrusted and the user has never interacted with the frame.

CONSOLE MESSAGE: SecurityError: The operation is insecure.
CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL &apos;http://127.0.0.1:8000/security/block-top-level-navigation-to-different-scheme-by-third-party-iframes.html&apos; from frame with URL &apos;http://localhost:8000/security/resources/navigate-top-level-frame-to-failure-page-different-scheme.html&apos;. The frame attempting navigation of the top-level window is cross-origin or untrusted and the user has never interacted with the frame.
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2193324</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-03-24 16:46:47 -0700</bug_when>
    <thetext>&lt;rdar://problem/173279243&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2193333</commentid>
    <comment_count>2</comment_count>
    <who name="Anthony Tarbinian">a.tarbinian</who>
    <bug_when>2026-03-24 16:58:48 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61287</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2193677</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-25 16:15:56 -0700</bug_when>
    <thetext>Committed 309948@main (33b1b5a695b2): &lt;https://commits.webkit.org/309948@main&gt;

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

    </bug>

</bugzilla>