RESOLVED FIXED185394
Avoid traversing the FrameTree up in FrameTree::top()
https://bugs.webkit.org/show_bug.cgi?id=185394
Summary Avoid traversing the FrameTree up in FrameTree::top()
Chris Dumez
Reported 2018-05-07 14:32:50 PDT
Avoid traversing the FrameTree up in FrameTree::top() and rely on Frame::mainFrame() instead to get the answer right away.
Attachments
Patch (1.67 KB, patch)
2018-05-07 14:36 PDT, Chris Dumez
sam: review+
Chris Dumez
Comment 1 2018-05-07 14:36:26 PDT
Sam Weinig
Comment 2 2018-05-07 18:58:52 PDT
Comment on attachment 339754 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=339754&action=review > Source/WebCore/ChangeLog:12 > + of returning the frame itself). However, it should not matter in practice as we should > + not be dealing with the FrameTree of a detached frame. Do we want to / can we assert this?
Chris Dumez
Comment 3 2018-05-07 19:11:12 PDT
Comment on attachment 339754 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=339754&action=review >> Source/WebCore/ChangeLog:12 >> + not be dealing with the FrameTree of a detached frame. > > 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.
Ahmad Saleem
Comment 4 2022-10-10 15:03:50 PDT
Checking via BugID, it seems this r+ patch didn'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!
Ahmad Saleem
Comment 5 2024-01-10 13:23:01 PST
Frame& FrameTree::top() const { ASSERT(m_thisFrame.isMainFrame() || tree().parent()); return m_thisFrame.mainFrame(); } This compiles with --release but didn't check with --debug.
EWS
Comment 6 2024-01-19 11:13:24 PST
Committed 273230@main (80993fda030b): <https://commits.webkit.org/273230@main> Reviewed commits have been landed. Closing PR #22760 and removing active labels.
Radar WebKit Bug Importer
Comment 7 2024-01-19 11:14:14 PST
Note You need to log in before you can comment on or make changes to this bug.