[Cocoa] Let the load delegate know when the Web process crashes
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2013 23:49:22 +0000 (23:49 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2013 23:49:22 +0000 (23:49 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@160512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h

index 8157569..3711f46 100644 (file)
@@ -1,3 +1,16 @@
+2013-12-12  Dan Bernstein  <mitz@apple.com>
+
+        [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  <andersca@apple.com>
 
         Move MessageSender to Platform/IPC.
index fdeae42..ba30f89 100644 (file)
@@ -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 <WKBrowsingContextLoadDelegatePrivate>)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);
 }
 
index 1f7b8d9..43181b1 100644 (file)
@@ -31,4 +31,6 @@
 - (BOOL)browsingContextController:(WKBrowsingContextController *)sender canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
 - (void)browsingContextController:(WKBrowsingContextController *)sender didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
 
+- (void)browsingContextControllerWebProcessDidCrash:(WKBrowsingContextController *)sender;
+
 @end