Title: [219136] trunk/Source/WebKit2
Revision
219136
Author
adac...@apple.com
Date
2017-07-05 10:43:59 -0700 (Wed, 05 Jul 2017)

Log Message

Fix crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
https://bugs.webkit.org/show_bug.cgi?id=174143
<rdar://problem/28384582>

Reviewed by Wenson Hsieh.

In -[WKActionSheet willRotate], we can't guarantee that the action sheet belongs
in a window, and passing nil to +[UIViewController _viewControllerForFullScreenPresentationFromView:]
throws an exception. To fix this, bail early if the result from -hostViewForSheet is nil.

* UIProcess/ios/WKActionSheet.mm:
(-[WKActionSheet willRotate]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (219135 => 219136)


--- trunk/Source/WebKit2/ChangeLog	2017-07-05 17:41:47 UTC (rev 219135)
+++ trunk/Source/WebKit2/ChangeLog	2017-07-05 17:43:59 UTC (rev 219136)
@@ -1,3 +1,18 @@
+2017-07-05  Ada Chan  <adac...@apple.com>
+
+        Fix crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
+        https://bugs.webkit.org/show_bug.cgi?id=174143
+        <rdar://problem/28384582>
+
+        Reviewed by Wenson Hsieh.
+
+        In -[WKActionSheet willRotate], we can't guarantee that the action sheet belongs
+        in a window, and passing nil to +[UIViewController _viewControllerForFullScreenPresentationFromView:]
+        throws an exception. To fix this, bail early if the result from -hostViewForSheet is nil.
+
+        * UIProcess/ios/WKActionSheet.mm:
+        (-[WKActionSheet willRotate]):
+
 2017-07-05  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Protect request and web view during gUM client callback

Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm (219135 => 219136)


--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm	2017-07-05 17:41:47 UTC (rev 219135)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm	2017-07-05 17:43:59 UTC (rev 219136)
@@ -153,6 +153,9 @@
     //    view controller, without re-presenting the alert controller.
 
     UIView *view = [_sheetDelegate hostViewForSheet];
+    if (!view)
+        return;
+
     UIViewController *presentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:view];
 
     // topPresentedViewController is either self (cases (a) and (b) above) or an action's view controller
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to