⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267287 in webkit


Ignore:
Timestamp:
Sep 18, 2020, 3:50:34 PM (6 years ago)
Author:
Chris Dumez
Message:

Crash under WebCore::shouldResetFocusNavigationStartingNode()
https://bugs.webkit.org/show_bug.cgi?id=216714
<rdar://problem/68132047>

Reviewed by Darin Adler.

Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure
it stays alive until the time we pass it to setFocusNavigationStartingNode().

  • page/FrameView.cpp:

(WebCore::FrameView::scrollToFragmentInternal):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267283 r267287  
     12020-09-18  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash under WebCore::shouldResetFocusNavigationStartingNode()
     4        https://bugs.webkit.org/show_bug.cgi?id=216714
     5        <rdar://problem/68132047>
     6
     7        Reviewed by Darin Adler.
     8
     9        Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure
     10        it stays alive until the time we pass it to setFocusNavigationStartingNode().
     11
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::scrollToFragmentInternal):
     14
    1152020-09-18  Aditya Keerthi  <akeerthi@apple.com>
    216
  • trunk/Source/WebCore/page/FrameView.cpp

    r267188 r267287  
    22142214    RELEASE_ASSERT(document.haveStylesheetsLoaded());
    22152215
    2216     Element* anchorElement = document.findAnchor(fragmentIdentifier);
    2217 
    2218     LOG(Scrolling, " anchorElement is %p", anchorElement);
     2216    auto anchorElement = makeRefPtr(document.findAnchor(fragmentIdentifier));
     2217
     2218    LOG(Scrolling, " anchorElement is %p", anchorElement.get());
    22192219
    22202220    // Setting to null will clear the current target.
    2221     document.setCSSTarget(anchorElement);
     2221    document.setCSSTarget(anchorElement.get());
    22222222
    22232223    if (is<SVGDocument>(document)) {
     
    22362236    }
    22372237
    2238     ContainerNode* scrollPositionAnchor = anchorElement;
     2238    RefPtr<ContainerNode> scrollPositionAnchor = anchorElement;
    22392239    if (!scrollPositionAnchor)
    22402240        scrollPositionAnchor = frame().document();
    2241     maintainScrollPositionAtAnchor(scrollPositionAnchor);
     2241    maintainScrollPositionAtAnchor(scrollPositionAnchor.get());
    22422242   
    22432243    // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
    22442244    if (anchorElement) {
    22452245        if (anchorElement->isFocusable())
    2246             document.setFocusedElement(anchorElement);
     2246            document.setFocusedElement(anchorElement.get());
    22472247        else {
    22482248            document.setFocusedElement(nullptr);
    2249             document.setFocusNavigationStartingNode(anchorElement);
     2249            document.setFocusNavigationStartingNode(anchorElement.get());
    22502250        }
    22512251    }
Note: See TracChangeset for help on using the changeset viewer.