Title: [232608] trunk/Source/WebKit
Revision
232608
Author
[email protected]
Date
2018-06-07 18:03:16 -0700 (Thu, 07 Jun 2018)

Log Message

[iOS] Inform the client when PDFKit's extension process crashes
https://bugs.webkit.org/show_bug.cgi?id=186418
<rdar://problem/40175864>

Reviewed by Tim Horton.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidTerminate):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):

Separated the dispatching of delegate methods from the rest of the web
process-specific processDidTerminate logic.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_setContentProviderData:suggestedFilename:]):

Minor style fix.

(-[WKPDFView pdfHostViewControllerExtensionProcessDidCrash:]):

Called WebPageProxy::dispatchProcessDidTerminate on the main thread.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (232607 => 232608)


--- trunk/Source/WebKit/ChangeLog	2018-06-07 23:23:55 UTC (rev 232607)
+++ trunk/Source/WebKit/ChangeLog	2018-06-08 01:03:16 UTC (rev 232608)
@@ -1,5 +1,30 @@
 2018-06-07  Andy Estes  <[email protected]>
 
+        [iOS] Inform the client when PDFKit's extension process crashes
+        https://bugs.webkit.org/show_bug.cgi?id=186418
+        <rdar://problem/40175864>
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::processDidTerminate):
+        (WebKit::WebPageProxy::dispatchProcessDidTerminate):
+
+        Separated the dispatching of delegate methods from the rest of the web
+        process-specific processDidTerminate logic.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
+
+        Minor style fix.
+
+        (-[WKPDFView pdfHostViewControllerExtensionProcessDidCrash:]):
+
+        Called WebPageProxy::dispatchProcessDidTerminate on the main thread.
+
+2018-06-07  Andy Estes  <[email protected]>
+
         [iOS] Unable to present the share sheet after saving a PDF to Files.app
         https://bugs.webkit.org/show_bug.cgi?id=186413
         <rdar://problem/39937488>

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (232607 => 232608)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-06-07 23:23:55 UTC (rev 232607)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-06-08 01:03:16 UTC (rev 232608)
@@ -5842,11 +5842,7 @@
         m_webProcessLifetimeTracker.webPageLeavingWebProcess();
     else {
         navigationState().clearAllNavigations();
-
-        if (m_navigationClient)
-            m_navigationClient->processDidTerminate(*this, reason);
-        else if (reason != ProcessTerminationReason::RequestedByClient)
-            m_loaderClient->processDidCrash(*this);
+        dispatchProcessDidTerminate(reason);
     }
 
     if (m_controlledByAutomation) {
@@ -5857,6 +5853,14 @@
     stopAllURLSchemeTasks();
 }
 
+void WebPageProxy::dispatchProcessDidTerminate(ProcessTerminationReason reason)
+{
+    if (m_navigationClient)
+        m_navigationClient->processDidTerminate(*this, reason);
+    else if (reason != ProcessTerminationReason::RequestedByClient)
+        m_loaderClient->processDidCrash(*this);
+}
+
 void WebPageProxy::stopAllURLSchemeTasks()
 {
     HashSet<WebURLSchemeHandler*> handlers;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (232607 => 232608)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-06-07 23:23:55 UTC (rev 232607)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-06-08 01:03:16 UTC (rev 232608)
@@ -917,6 +917,7 @@
     void processDidBecomeUnresponsive();
     void processDidBecomeResponsive();
     void processDidTerminate(ProcessTerminationReason);
+    void dispatchProcessDidTerminate(ProcessTerminationReason);
     void willChangeProcessIsResponsive();
     void didChangeProcessIsResponsive();
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (232607 => 232608)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-06-07 23:23:55 UTC (rev 232607)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-06-08 01:03:16 UTC (rev 232608)
@@ -105,8 +105,7 @@
     _data = adoptNS([data copy]);
     _suggestedFilename = adoptNS([filename copy]);
 
-    WeakObjCPtr<WKPDFView> weakSelf = self;
-    [PDFHostViewController createHostView:[self, weakSelf = WTFMove(weakSelf)](PDFHostViewController * _Nullable hostViewController) {
+    [PDFHostViewController createHostView:[self, weakSelf = WeakObjCPtr<WKPDFView>(self)](PDFHostViewController * _Nullable hostViewController) {
         ASSERT(isMainThread());
 
         WKPDFView *autoreleasedSelf = weakSelf.getAutoreleased();
@@ -455,7 +454,16 @@
     [self _showActionSheetForURL:[self _URLWithPageIndex:pageIndex] atLocation:location withAnnotationRect:annotationRect];
 }
 
+- (void)pdfHostViewControllerExtensionProcessDidCrash:(PDFHostViewController *)controller
+{
+    // FIXME 40916725: PDFKit should dispatch this message to the main thread like it does for other delegate messages.
+    dispatch_async(dispatch_get_main_queue(), [webView = _webView] {
+        if (auto page = [webView _page])
+            page->dispatchProcessDidTerminate(WebKit::ProcessTerminationReason::Crash);
+    });
+}
 
+
 #pragma mark WKActionSheetAssistantDelegate
 
 - (std::optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to