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

Changeset 267678 in webkit


Ignore:
Timestamp:
Sep 27, 2020, 1:00:28 PM (6 years ago)
Author:
Alan Coon
Message:

Cherry-pick r267287. rdar://problem/69594243

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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-610-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610-branch/Source/WebCore/ChangeLog

    r267676 r267678  
     12020-09-27  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r267287. rdar://problem/69594243
     4
     5    Crash under WebCore::shouldResetFocusNavigationStartingNode()
     6    https://bugs.webkit.org/show_bug.cgi?id=216714
     7    <rdar://problem/68132047>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure
     12    it stays alive until the time we pass it to setFocusNavigationStartingNode().
     13   
     14    * page/FrameView.cpp:
     15    (WebCore::FrameView::scrollToFragmentInternal):
     16   
     17   
     18    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     19
     20    2020-09-18  Chris Dumez  <cdumez@apple.com>
     21
     22            Crash under WebCore::shouldResetFocusNavigationStartingNode()
     23            https://bugs.webkit.org/show_bug.cgi?id=216714
     24            <rdar://problem/68132047>
     25
     26            Reviewed by Darin Adler.
     27
     28            Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure
     29            it stays alive until the time we pass it to setFocusNavigationStartingNode().
     30
     31            * page/FrameView.cpp:
     32            (WebCore::FrameView::scrollToFragmentInternal):
     33
    1342020-09-27  Alan Coon  <alancoon@apple.com>
    235
  • branches/safari-610-branch/Source/WebCore/page/FrameView.cpp

    r267673 r267678  
    22082208    RELEASE_ASSERT(document.haveStylesheetsLoaded());
    22092209
    2210     Element* anchorElement = document.findAnchor(fragmentIdentifier);
    2211 
    2212     LOG(Scrolling, " anchorElement is %p", anchorElement);
     2210    auto anchorElement = makeRefPtr(document.findAnchor(fragmentIdentifier));
     2211
     2212    LOG(Scrolling, " anchorElement is %p", anchorElement.get());
    22132213
    22142214    // Setting to null will clear the current target.
    2215     document.setCSSTarget(anchorElement);
     2215    document.setCSSTarget(anchorElement.get());
    22162216
    22172217    if (is<SVGDocument>(document)) {
     
    22302230    }
    22312231
    2232     ContainerNode* scrollPositionAnchor = anchorElement;
     2232    RefPtr<ContainerNode> scrollPositionAnchor = anchorElement;
    22332233    if (!scrollPositionAnchor)
    22342234        scrollPositionAnchor = frame().document();
    2235     maintainScrollPositionAtAnchor(scrollPositionAnchor);
     2235    maintainScrollPositionAtAnchor(scrollPositionAnchor.get());
    22362236   
    22372237    // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
    22382238    if (anchorElement) {
    22392239        if (anchorElement->isFocusable())
    2240             document.setFocusedElement(anchorElement);
     2240            document.setFocusedElement(anchorElement.get());
    22412241        else {
    22422242            document.setFocusedElement(nullptr);
    2243             document.setFocusNavigationStartingNode(anchorElement);
     2243            document.setFocusNavigationStartingNode(anchorElement.get());
    22442244        }
    22452245    }
Note: See TracChangeset for help on using the changeset viewer.