<?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>185394</bug_id>
          
          <creation_ts>2018-05-07 14:32:50 -0700</creation_ts>
          <short_desc>Avoid traversing the FrameTree up in FrameTree::top()</short_desc>
          <delta_ts>2024-01-19 11:14:14 -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>Frames</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="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ggaren</cc>
    
    <cc>koivisto</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1421441</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-07 14:32:50 -0700</bug_when>
    <thetext>Avoid traversing the FrameTree up in FrameTree::top() and rely on Frame::mainFrame() instead to get the answer right away.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1421443</commentid>
    <comment_count>1</comment_count>
      <attachid>339754</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-07 14:36:26 -0700</bug_when>
    <thetext>Created attachment 339754
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1421584</commentid>
    <comment_count>2</comment_count>
      <attachid>339754</attachid>
    <who name="Sam Weinig">sam</who>
    <bug_when>2018-05-07 18:58:52 -0700</bug_when>
    <thetext>Comment on attachment 339754
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=339754&amp;action=review

&gt; Source/WebCore/ChangeLog:12
&gt; +        of returning the frame itself). However, it should not matter in practice as we should
&gt; +        not be dealing with the FrameTree of a detached frame.

Do we want to / can we assert this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1421589</commentid>
    <comment_count>3</comment_count>
      <attachid>339754</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-07 19:11:12 -0700</bug_when>
    <thetext>Comment on attachment 339754
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=339754&amp;action=review

&gt;&gt; Source/WebCore/ChangeLog:12
&gt;&gt; +        not be dealing with the FrameTree of a detached frame.
&gt; 
&gt; Do we want to / can we assert this?

Like an ASSERT(m_thisFrame.isMainFrame() || tree().parent()); inside FrameTree::top() ? This would make sure no one calls FrameTree::top() on a detached Frame. I am not sure if such assertion would be hit or not. I could try.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1904635</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-10-10 15:03:50 -0700</bug_when>
    <thetext>Checking via BugID, it seems this r+ patch didn&apos;t landed and old code is still present:

https://github.com/WebKit/WebKit/blob/8f0e98e67893ed3be45684a65a42de9bf244ed81/Source/WebCore/page/FrameTree.cpp#L454

Do we need this? Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2004193</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-01-10 13:23:01 -0800</bug_when>
    <thetext>Frame&amp; FrameTree::top() const
{
    ASSERT(m_thisFrame.isMainFrame() || tree().parent());
    return m_thisFrame.mainFrame();


}

This compiles with --release but didn&apos;t check with --debug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2006180</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-01-19 11:13:24 -0800</bug_when>
    <thetext>Committed 273230@main (80993fda030b): &lt;https://commits.webkit.org/273230@main&gt;

Reviewed commits have been landed. Closing PR #22760 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2006181</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-01-19 11:14:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/121272959&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>339754</attachid>
            <date>2018-05-07 14:36:26 -0700</date>
            <delta_ts>2022-02-27 23:21:14 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-185394-20180507143625.patch</filename>
            <type>text/plain</type>
            <size>1705</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjMxNDUwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNjZmZjZlMWIxMmVhMzg0
ODYwZjgwOWU3ZWIzYWNlMGJiNGQxMDdmNi4uN2FhNGIzODFiY2E2Y2I1MTYzOGU0OGI1ZDcxZjM1
MmQ0ODMwNTYzZSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBACisyMDE4LTA1LTA3ICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb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lzIG5vdCBzZXQKZGlmZiAtLWdpdCBhL1NvdXJj
ZS9XZWJDb3JlL3BhZ2UvRnJhbWVUcmVlLmNwcCBiL1NvdXJjZS9XZWJDb3JlL3BhZ2UvRnJhbWVU
cmVlLmNwcAppbmRleCA0MmNiMzMzYTBjMDlkNTE0ZGIwZjE3YzdjZjBkYjZmODc2NmJmZDMwLi45
N2JhYzVmYzc3MmEzYTE2MzU5MzI2ODlkNDMyNWU1OGUyNmYwZWRhIDEwMDY0NAotLS0gYS9Tb3Vy
Y2UvV2ViQ29yZS9wYWdlL0ZyYW1lVHJlZS5jcHAKKysrIGIvU291cmNlL1dlYkNvcmUvcGFnZS9G
cmFtZVRyZWUuY3BwCkBAIC00MjcsMTAgKzQyNyw3IEBAIEZyYW1lKiBGcmFtZVRyZWU6OmRlZXBM
YXN0Q2hpbGQoKSBjb25zdAogCiBGcmFtZSYgRnJhbWVUcmVlOjp0b3AoKSBjb25zdAogewotICAg
IEZyYW1lKiBmcmFtZSA9ICZtX3RoaXNGcmFtZTsKLSAgICBmb3IgKEZyYW1lKiBwYXJlbnQgPSAm
bV90aGlzRnJhbWU7IHBhcmVudDsgcGFyZW50ID0gcGFyZW50LT50cmVlKCkucGFyZW50KCkpCi0g
ICAgICAgIGZyYW1lID0gcGFyZW50OwotICAgIHJldHVybiAqZnJhbWU7CisgICAgcmV0dXJuIG1f
dGhpc0ZyYW1lLm1haW5GcmFtZSgpOwogfQogCiB9IC8vIG5hbWVzcGFjZSBXZWJDb3JlCg==
</data>
<flag name="review"
          id="358017"
          type_id="1"
          status="+"
          setter="sam"
    />
          </attachment>
      

    </bug>

</bugzilla>