v3: CrashTracer: Regression : MobileSafari at UIKitCore: -[UITargetedPreview initWith...
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 22:13:08 +0000 (22:13 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 22:13:08 +0000 (22:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200634

Patch by Luming Yin <luming_yin@apple.com> on 2019-08-14
Reviewed by Simon Fraser.

Under rare race conditions, the WKContentView may no longer have an associated window. However,
UIContextMenuInteraction may still attempt initialize a UITargetedPreview with the orphaned
WKContentView. Speculative fix for crashes under such scenarios, so that we can continue without
a context menu configuration to prevent the UIKit exception.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 469900d..19fed51 100644 (file)
@@ -1,3 +1,18 @@
+2019-08-14  Luming Yin  <luming_yin@apple.com>
+
+        v3: CrashTracer: Regression : MobileSafari at UIKitCore: -[UITargetedPreview initWithView:parameters:]
+        https://bugs.webkit.org/show_bug.cgi?id=200634
+
+        Reviewed by Simon Fraser.
+
+        Under rare race conditions, the WKContentView may no longer have an associated window. However, 
+        UIContextMenuInteraction may still attempt initialize a UITargetedPreview with the orphaned 
+        WKContentView. Speculative fix for crashes under such scenarios, so that we can continue without 
+        a context menu configuration to prevent the UIKit exception.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView continueContextMenuInteraction:]):
+
 2019-08-14  Zalan Bujtas  <zalan@apple.com>
 
         [ContentChangeObserver] Stop content change observation explicitly.
index 9e16ccb..ef3ae44 100644 (file)
@@ -7932,6 +7932,9 @@ static UIMenu *menuWithShowLinkPreviewAction(UIMenu *originalMenu)
 
 - (void)continueContextMenuInteraction:(void(^)(UIContextMenuConfiguration *))continueWithContextMenuConfiguration
 {
+    if (!self.window)
+        return continueWithContextMenuConfiguration(nil);
+
     if (!_positionInformation.touchCalloutEnabled)
         return continueWithContextMenuConfiguration(nil);