Title: [185680] trunk/Source/WebKit2
Revision
185680
Author
[email protected]
Date
2015-06-17 17:22:23 -0700 (Wed, 17 Jun 2015)

Log Message

Would like a way, in the API, to get notified about a web process crash
https://bugs.webkit.org/show_bug.cgi?id=146085
rdar://problem/17358828

Reviewed by Darin Adler.

* UIProcess/API/Cocoa/WKNavigationDelegate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::processDidCrash):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185679 => 185680)


--- trunk/Source/WebKit2/ChangeLog	2015-06-18 00:03:42 UTC (rev 185679)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-18 00:22:23 UTC (rev 185680)
@@ -1,3 +1,17 @@
+2015-06-17  Anders Carlsson  <[email protected]>
+
+        Would like a way, in the API, to get notified about a web process crash
+        https://bugs.webkit.org/show_bug.cgi?id=146085
+        rdar://problem/17358828
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/Cocoa/WKNavigationDelegate.h:
+        * UIProcess/Cocoa/NavigationState.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::setNavigationDelegate):
+        (WebKit::NavigationState::NavigationClient::processDidCrash):
+
 2015-06-17  Tim Horton  <[email protected]>
 
         Swipe gesture can get stuck, preventing scrolling and other gestures

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegate.h (185679 => 185680)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegate.h	2015-06-18 00:03:42 UTC (rev 185679)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegate.h	2015-06-18 00:22:23 UTC (rev 185680)
@@ -139,6 +139,11 @@
  */
 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *WK_NULLABLE_SPECIFIER credential))completionHandler;
 
+/*! @abstract Invoked when the web view's web content process is terminated.
+ @param webView The web view whose underlying web content process was terminated.
+ */
+- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
 @end
 
 WK_ASSUME_NONNULL_END

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (185679 => 185680)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-06-18 00:03:42 UTC (rev 185679)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-06-18 00:22:23 UTC (rev 185680)
@@ -158,6 +158,7 @@
 
         bool webViewRenderingProgressDidChange : 1;
         bool webViewDidReceiveAuthenticationChallengeCompletionHandler : 1;
+        bool webViewWebContentProcessDidTerminate : 1;
         bool webViewCanAuthenticateAgainstProtectionSpace : 1;
         bool webViewDidReceiveAuthenticationChallenge : 1;
         bool webViewWebProcessDidCrash : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (185679 => 185680)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-06-18 00:03:42 UTC (rev 185679)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-06-18 00:22:23 UTC (rev 185680)
@@ -142,6 +142,7 @@
     m_navigationDelegateMethods.webViewNavigationDidSameDocumentNavigation = [delegate respondsToSelector:@selector(_webView:navigation:didSameDocumentNavigation:)];
     m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
     m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler = [delegate respondsToSelector:@selector(webView:didReceiveAuthenticationChallenge:completionHandler:)];
+    m_navigationDelegateMethods.webViewWebContentProcessDidTerminate = [delegate respondsToSelector:@selector(webViewWebContentProcessDidTerminate:)];
     m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace = [delegate respondsToSelector:@selector(_webView:canAuthenticateAgainstProtectionSpace:)];
     m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
     m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)];
@@ -635,13 +636,19 @@
 
 void NavigationState::NavigationClient::processDidCrash(WebKit::WebPageProxy& page)
 {
-    if (!m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidCrash)
+    if (!m_navigationState.m_navigationDelegateMethods.webViewWebContentProcessDidTerminate && !m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidCrash)
         return;
 
     auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     if (!navigationDelegate)
         return;
 
+    // We prefer webViewWebContentProcessDidTerminate: over _webViewWebProcessDidCrash:.
+    if (m_navigationState.m_navigationDelegateMethods.webViewWebContentProcessDidTerminate) {
+        [navigationDelegate webViewWebContentProcessDidTerminate:m_navigationState.m_webView];
+        return;
+    }
+
     [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webViewWebProcessDidCrash:m_navigationState.m_webView];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to