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

Changeset 244781 in webkit


Ignore:
Timestamp:
Apr 30, 2019, 10:37:47 AM (7 years ago)
Author:
timothy_horton@apple.com
Message:

Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
https://bugs.webkit.org/show_bug.cgi?id=197404
<rdar://problem/24589331>

Reviewed by Wenson Hsieh.

  • UIProcess/mac/WKImmediateActionController.mm:

(-[WKImmediateActionController _updateImmediateActionItem]):
(-[WKImmediateActionController menuItem:previewItemAtPoint:]):
(-[WKImmediateActionController menuItem:itemFrameForPoint:]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
Add some null checks; _webHitTestResult can be null if we (somehow) get
an immediate action gesture without having previously gotten a
mouseDidMoveOverElement from the Web Content process. Cover all our bases.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244779 r244781  
     12019-04-30  Tim Horton  <timothy_horton@apple.com>
     2
     3        Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
     4        https://bugs.webkit.org/show_bug.cgi?id=197404
     5        <rdar://problem/24589331>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * UIProcess/mac/WKImmediateActionController.mm:
     10        (-[WKImmediateActionController _updateImmediateActionItem]):
     11        (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
     12        (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
     13        (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
     14        Add some null checks; _webHitTestResult can be null if we (somehow) get
     15        an immediate action gesture without having previously gotten a
     16        mouseDidMoveOverElement from the Web Content process. Cover all our bases.
     17
    1182019-04-30  Per Arne Vollan  <pvollan@apple.com>
    219
  • trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm

    r238771 r244781  
    329329
    330330    RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
     331    if (!hitTestResult) {
     332        [self _cancelImmediateAction];
     333        return;
     334    }
     335
    331336    id customClientAnimationController = _page->immediateActionAnimationControllerForHitTestResult(hitTestResult, _type, _userData);
    332337    if (customClientAnimationController == [NSNull null]) {
     
    354359
    355360    RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
     361    if (!hitTestResult)
     362        return nil;
     363
    356364    return [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()];
    357365}
     
    373381
    374382    RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
     383    if (!hitTestResult)
     384        return NSZeroRect;
     385
    375386    return [_view convertRect:hitTestResult->elementBoundingBox() toView:nil];
    376387}
     
    450461
    451462    RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
     463    if (!hitTestResult)
     464        return nil;
     465
    452466    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
    453467
Note: See TracChangeset for help on using the changeset viewer.