Title: [282991] branches/safari-612-branch/Source/WebKit
Revision
282991
Author
[email protected]
Date
2021-09-23 13:13:46 -0700 (Thu, 23 Sep 2021)

Log Message

Cherry-pick r281352. rdar://problem/83461013

    [macCatalyst] Crash when clicking a phone number link
    https://bugs.webkit.org/show_bug.cgi?id=229344
    rdar://81804638

    Reviewed by Tim Horton.

    Clicking on a phone number link should present data detection UI.
    However, `-[WKActionSheetAssistant _elementActionForDDAction:]` always
    returns nil on Catalyst, resulting in crash when attempting to add the
    returned action to an NSArray.

    Given that the methods used in `_elementActionForDDAction:` are available
    on Catalyst, fix the crash by ensuring the method does not return nil, and
    only making the method available on platforms where ENABLE(DATA_DETECTION)
    is defined.

    * UIProcess/ios/WKActionSheetAssistant.mm:
    (-[WKActionSheetAssistant _elementActionForDDAction:]):

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

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (282990 => 282991)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-09-23 20:13:43 UTC (rev 282990)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-09-23 20:13:46 UTC (rev 282991)
@@ -1,3 +1,50 @@
+2021-09-23  Russell Epstein  <[email protected]>
+
+        Cherry-pick r281352. rdar://problem/83461013
+
+    [macCatalyst] Crash when clicking a phone number link
+    https://bugs.webkit.org/show_bug.cgi?id=229344
+    rdar://81804638
+    
+    Reviewed by Tim Horton.
+    
+    Clicking on a phone number link should present data detection UI.
+    However, `-[WKActionSheetAssistant _elementActionForDDAction:]` always
+    returns nil on Catalyst, resulting in crash when attempting to add the
+    returned action to an NSArray.
+    
+    Given that the methods used in `_elementActionForDDAction:` are available
+    on Catalyst, fix the crash by ensuring the method does not return nil, and
+    only making the method available on platforms where ENABLE(DATA_DETECTION)
+    is defined.
+    
+    * UIProcess/ios/WKActionSheetAssistant.mm:
+    (-[WKActionSheetAssistant _elementActionForDDAction:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-20  Aditya Keerthi  <[email protected]>
+
+            [macCatalyst] Crash when clicking a phone number link
+            https://bugs.webkit.org/show_bug.cgi?id=229344
+            rdar://81804638
+
+            Reviewed by Tim Horton.
+
+            Clicking on a phone number link should present data detection UI.
+            However, `-[WKActionSheetAssistant _elementActionForDDAction:]` always
+            returns nil on Catalyst, resulting in crash when attempting to add the
+            returned action to an NSArray.
+
+            Given that the methods used in `_elementActionForDDAction:` are available
+            on Catalyst, fix the crash by ensuring the method does not return nil, and
+            only making the method available on platforms where ENABLE(DATA_DETECTION)
+            is defined.
+
+            * UIProcess/ios/WKActionSheetAssistant.mm:
+            (-[WKActionSheetAssistant _elementActionForDDAction:]):
+
 2021-09-23  Alan Coon  <[email protected]>
 
         Cherry-pick r282881. rdar://problem/83430003

Modified: branches/safari-612-branch/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (282990 => 282991)


--- branches/safari-612-branch/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2021-09-23 20:13:43 UTC (rev 282990)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2021-09-23 20:13:46 UTC (rev 282991)
@@ -190,23 +190,6 @@
     return [self superviewForSheet];
 }
 
-- (_WKElementAction *)_elementActionForDDAction:(DDAction *)action
-{
-#if PLATFORM(IOS) && !PLATFORM(MACCATALYST)
-    auto retainedSelf = retainPtr(self);
-    _WKElementAction *elementAction = [_WKElementAction elementActionWithTitle:action.localizedName actionHandler:^(_WKActivatedElementInfo *actionInfo) {
-        retainedSelf->_isPresentingDDUserInterface = action.hasUserInterface;
-        [[getDDDetectionControllerClass() sharedController] performAction:action fromAlertController:retainedSelf->_interactionSheet.get() interactionDelegate:retainedSelf.get()];
-    }];
-    elementAction.dismissalHandler = ^BOOL {
-        return !action.hasUserInterface;
-    };
-    return elementAction;
-#else
-    return nil;
-#endif
-}
-
 static const CGFloat presentationElementRectPadding = 15;
 
 - (CGRect)presentationRectForElementUsingClosestIndicatedRect
@@ -734,6 +717,23 @@
 
 #endif // USE(UICONTEXTMENU)
 
+#if ENABLE(DATA_DETECTION)
+
+- (_WKElementAction *)_elementActionForDDAction:(DDAction *)action
+{
+    auto retainedSelf = retainPtr(self);
+    _WKElementAction *elementAction = [_WKElementAction elementActionWithTitle:action.localizedName actionHandler:^(_WKActivatedElementInfo *actionInfo) {
+        retainedSelf->_isPresentingDDUserInterface = action.hasUserInterface;
+        [[getDDDetectionControllerClass() sharedController] performAction:action fromAlertController:retainedSelf->_interactionSheet.get() interactionDelegate:retainedSelf.get()];
+    }];
+    elementAction.dismissalHandler = ^BOOL {
+        return !action.hasUserInterface;
+    };
+    return elementAction;
+}
+
+#endif // ENABLE(DATA_DETECTION)
+
 - (void)showDataDetectorsUIForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
 {
 #if ENABLE(DATA_DETECTION)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to