From f451bf4d2bf25e3844bac0e41ef0bdb6ae8a8ca9 Mon Sep 17 00:00:00 2001 From: "mitz@apple.com" Date: Thu, 12 Dec 2013 23:49:22 +0000 Subject: [PATCH] [Cocoa] Let the load delegate know when the Web process crashes https://bugs.webkit.org/show_bug.cgi?id=125660 Reviewed by Sam Weinig. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (processDidCrash): Implemented this WKPageLoaderClient callback by calling the load delegate. (setUpPageLoaderClient): Set the above callback in the client structure * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Declare new delegate method. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160512 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 13 +++++++++++++ .../API/Cocoa/WKBrowsingContextController.mm | 11 +++++++++++ .../Cocoa/WKBrowsingContextLoadDelegatePrivate.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 8157569679e..3711f46014d 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,16 @@ +2013-12-12 Dan Bernstein + + [Cocoa] Let the load delegate know when the Web process crashes + https://bugs.webkit.org/show_bug.cgi?id=125660 + + Reviewed by Sam Weinig. + + * UIProcess/API/Cocoa/WKBrowsingContextController.mm: + (processDidCrash): Implemented this WKPageLoaderClient callback by calling the load + delegate. + (setUpPageLoaderClient): Set the above callback in the client structure + * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Declare new delegate method. + 2013-12-12 Anders Carlsson Move MessageSender to Platform/IPC. diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm b/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm index fdeae42eeae..ba30f89dcae 100644 --- a/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm +++ b/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm @@ -512,6 +512,15 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad [loadDelegate browsingContextControllerDidChangeBackForwardList:browsingContext addedItem:added removedItems:removed]; } +static void processDidCrash(WKPageRef page, const void* clientInfo) +{ + WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; + auto loadDelegate = browsingContext->_loadDelegate.get(); + + if ([loadDelegate respondsToSelector:@selector(browsingContextControllerWebProcessDidCrash:)]) + [(id )loadDelegate browsingContextControllerWebProcessDidCrash:browsingContext]; +} + static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, WebPageProxy& page) { WKPageLoaderClientV3 loaderClient; @@ -534,6 +543,8 @@ static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, loaderClient.didFinishProgress = didFinishProgress; loaderClient.didChangeBackForwardList = didChangeBackForwardList; + loaderClient.processDidCrash = processDidCrash; + page.initializeLoaderClient(&loaderClient.base); } diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h b/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h index 1f7b8d9b818..43181b15d93 100644 --- a/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h +++ b/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h @@ -31,4 +31,6 @@ - (BOOL)browsingContextController:(WKBrowsingContextController *)sender canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace; - (void)browsingContextController:(WKBrowsingContextController *)sender didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; +- (void)browsingContextControllerWebProcessDidCrash:(WKBrowsingContextController *)sender; + @end -- GitLab