<?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>297874</bug_id>
          
          <creation_ts>2025-08-25 14:49:56 -0700</creation_ts>
          <short_desc>[Site Isolation] Crash when accessing cross origin iframe contentWindow from WebInspector</short_desc>
          <delta_ts>2025-09-09 15:47:20 -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>WebKit Process Model</component>
          <version>WebKit Local Build</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 26</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>nham</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2138690</commentid>
    <comment_count>0</comment_count>
    <who name="Anthony Tarbinian">a.tarbinian</who>
    <bug_when>2025-08-25 14:49:56 -0700</bug_when>
    <thetext>rdar://159134034 InRadar</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138702</commentid>
    <comment_count>1</comment_count>
    <who name="Anthony Tarbinian">a.tarbinian</who>
    <bug_when>2025-08-25 15:19:12 -0700</bug_when>
    <thetext>Summary:
Crash when accessing the contenWindow attribute of a cross origin iframe with site isolation turned on. Only reproducible when running JS from the WebInspector. 

Steps To Reproduce:
1. Open MiniBrowser
2. Ensure that site isolation is enabled (Settings -&gt; Internal Features -&gt; Site Isolation)
3. Navigate to about:blank
4. Open the Web Inspector Console
5. Run the following JS in the console:
```
let i = document.createElement(&apos;iframe&apos;); document.body.appendChild(i);
i.src = &apos;https://example.org&apos;;
console.log(i.contentWindow);
```

Results:
Observe a crash when trying to access the contentWindow attribute.

Crash occurs because a downcast from RemoteDOMWindow to LocalDOMWindow fails (specifically fails this assert https://searchfox.org/wubkat/source/Source/WTF/wtf/TypeCasts.h#96).

The downcast is invoked from `WebCore::activeDOMWindow` which was originally called from `JSDOMBindingSecurity::remoteFrameAccessError` https://searchfox.org/wubkat/source/Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp#49.


Regression:
Issue only occurs from running the JS inside the WebInspector. Adding a cross origin iframe and accessing its contentWindow works fine in layout tests, just note in the WebInspector UI. Reproducing on WebKit commit 9892235 from 8/20.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138708</commentid>
    <comment_count>2</comment_count>
    <who name="Anthony Tarbinian">a.tarbinian</who>
    <bug_when>2025-08-25 15:44:30 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/49861</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2141991</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-09-09 15:47:16 -0700</bug_when>
    <thetext>Committed 299777@main (8fb7be5683f4): &lt;https://commits.webkit.org/299777@main&gt;

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

    </bug>

</bugzilla>