⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185680 in webkit


Ignore:
Timestamp:
Jun 17, 2015, 5:22:23 PM (11 years ago)
Author:
andersca@apple.com
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):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185679 r185680  
     12015-06-17  Anders Carlsson  <andersca@apple.com>
     2
     3        Would like a way, in the API, to get notified about a web process crash
     4        https://bugs.webkit.org/show_bug.cgi?id=146085
     5        rdar://problem/17358828
     6
     7        Reviewed by Darin Adler.
     8
     9        * UIProcess/API/Cocoa/WKNavigationDelegate.h:
     10        * UIProcess/Cocoa/NavigationState.h:
     11        * UIProcess/Cocoa/NavigationState.mm:
     12        (WebKit::NavigationState::setNavigationDelegate):
     13        (WebKit::NavigationState::NavigationClient::processDidCrash):
     14
    1152015-06-17  Tim Horton  <timothy_horton@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegate.h

    r181859 r185680  
    140140- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *WK_NULLABLE_SPECIFIER credential))completionHandler;
    141141
     142/*! @abstract Invoked when the web view's web content process is terminated.
     143 @param webView The web view whose underlying web content process was terminated.
     144 */
     145- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
     146
    142147@end
    143148
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r179786 r185680  
    159159        bool webViewRenderingProgressDidChange : 1;
    160160        bool webViewDidReceiveAuthenticationChallengeCompletionHandler : 1;
     161        bool webViewWebContentProcessDidTerminate : 1;
    161162        bool webViewCanAuthenticateAgainstProtectionSpace : 1;
    162163        bool webViewDidReceiveAuthenticationChallenge : 1;
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r183784 r185680  
    143143    m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
    144144    m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler = [delegate respondsToSelector:@selector(webView:didReceiveAuthenticationChallenge:completionHandler:)];
     145    m_navigationDelegateMethods.webViewWebContentProcessDidTerminate = [delegate respondsToSelector:@selector(webViewWebContentProcessDidTerminate:)];
    145146    m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace = [delegate respondsToSelector:@selector(_webView:canAuthenticateAgainstProtectionSpace:)];
    146147    m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
     
    636637void NavigationState::NavigationClient::processDidCrash(WebKit::WebPageProxy& page)
    637638{
    638     if (!m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidCrash)
    639         return;
    640 
    641     auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
    642     if (!navigationDelegate)
    643         return;
     639    if (!m_navigationState.m_navigationDelegateMethods.webViewWebContentProcessDidTerminate && !m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidCrash)
     640        return;
     641
     642    auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     643    if (!navigationDelegate)
     644        return;
     645
     646    // We prefer webViewWebContentProcessDidTerminate: over _webViewWebProcessDidCrash:.
     647    if (m_navigationState.m_navigationDelegateMethods.webViewWebContentProcessDidTerminate) {
     648        [navigationDelegate webViewWebContentProcessDidTerminate:m_navigationState.m_webView];
     649        return;
     650    }
    644651
    645652    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webViewWebProcessDidCrash:m_navigationState.m_webView];
Note: See TracChangeset for help on using the changeset viewer.