Title: [245915] branches/safari-607-branch/Source/WebKit
Revision
245915
Author
[email protected]
Date
2019-05-30 17:29:35 -0700 (Thu, 30 May 2019)

Log Message

Cherry-pick r244781. rdar://problem/51264871

    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.

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (245914 => 245915)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-05-31 00:12:03 UTC (rev 245914)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-05-31 00:29:35 UTC (rev 245915)
@@ -1,3 +1,42 @@
+2019-05-30  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r244781. rdar://problem/51264871
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-04-30  Tim Horton  <[email protected]>
+
+            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.
+
 2019-05-14  Kocsen Chung  <[email protected]>
 
         Apply patch. rdar://problem/50753918

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm (245914 => 245915)


--- branches/safari-607-branch/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2019-05-31 00:12:03 UTC (rev 245914)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2019-05-31 00:29:35 UTC (rev 245915)
@@ -328,6 +328,11 @@
     }
 
     RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
+    if (!hitTestResult) {
+        [self _cancelImmediateAction];
+        return;
+    }
+
     id customClientAnimationController = _page->immediateActionAnimationControllerForHitTestResult(hitTestResult, _type, _userData);
     if (customClientAnimationController == [NSNull null]) {
         [self _cancelImmediateAction];
@@ -353,6 +358,9 @@
         return nil;
 
     RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
+    if (!hitTestResult)
+        return nil;
+
     return [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()];
 }
 
@@ -372,6 +380,9 @@
         return NSZeroRect;
 
     RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
+    if (!hitTestResult)
+        return NSZeroRect;
+
     return [_view convertRect:hitTestResult->elementBoundingBox() toView:nil];
 }
 
@@ -449,6 +460,9 @@
     [_currentActionContext setHighlightFrame:[_view.window convertRectToScreen:[_view convertRect:_hitTestResultData.elementBoundingBox toView:nil]]];
 
     RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
+    if (!hitTestResult)
+        return nil;
+
     NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
 
     if (menuItems.count != 1)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to