Diff
Modified: trunk/Source/WebKit2/ChangeLog (219086 => 219087)
--- trunk/Source/WebKit2/ChangeLog 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/ChangeLog 2017-07-03 19:47:11 UTC (rev 219087)
@@ -1,3 +1,37 @@
+2017-07-03 Ryosuke Niwa <[email protected]>
+
+ WebContent processes crash when the network process crashes with pending connection requests
+ https://bugs.webkit.org/show_bug.cgi?id=174065
+ <rdar://problem/30359835>
+
+ Reviewed by Tim Horton.
+
+ The bug was caused by the UI process clearing away pending network connection requests whenever the existing
+ network process crashed. This resulted in WebContent process killing itself inside ensureNetworkProcessConnection.
+
+ Fixed the bug by re-launching a new network process when this happens. We don't try to re-launch a new process
+ if the previous attempt to launch a network process had failed.
+
+ This patch splits NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch into networkProcessFailedToLaunch
+ and networkProcessCrashed to differentiate those two cases, and invoke the respective callbacks in WebProcessPool.
+
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _networkProcessIdentifier]): Added.
+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::networkProcessCrashed): Added.
+ (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): Split into the two following functions.
+ (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch): Extracted from networkProcessCrashedOrFailedToLaunch.
+ (WebKit::NetworkProcessProxy::clearCallbackStates): Extracted from networkProcessCrashedOrFailedToLaunch
+ (WebKit::NetworkProcessProxy::didClose): Call networkProcessCrashed.
+ (WebKit::NetworkProcessProxy::didFinishLaunching): Call networkProcessFailedToLaunch.
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::networkProcessCrashed): Start a new network process when there are pending connection
+ requests the crached network failed to fullfil.
+ (WebKit::WebProcessPool::networkProcessFailedToLaunch):
+ * UIProcess/WebProcessPool.h:
+
2017-07-03 Eric Carlson <[email protected]>
[MediaStream] Protect request and web view during gUM client callback
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2017-07-03 19:47:11 UTC (rev 219087)
@@ -394,6 +394,11 @@
_processPool->terminateNetworkProcess();
}
+- (pid_t)_networkProcessIdentifier
+{
+ return _processPool->networkProcessIdentifier();
+}
+
- (void)_syncNetworkProcessCookies
{
_processPool->syncNetworkProcessCookies();
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2017-07-03 19:47:11 UTC (rev 219087)
@@ -76,6 +76,9 @@
- (void)_terminateNetworkProcess;
// Test only.
+- (pid_t)_networkProcessIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+// Test only.
- (size_t)_webProcessCount WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_syncNetworkProcessCookies WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp 2017-07-03 19:47:11 UTC (rev 219087)
@@ -164,8 +164,21 @@
send(Messages::NetworkProcess::DeleteWebsiteDataForOrigins(sessionID, dataTypes, origins, cookieHostNames, callbackID), 0);
}
-void NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch()
+void NetworkProcessProxy::networkProcessCrashed()
{
+ clearCallbackStates();
+
+ Vector<Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>> pendingReplies;
+ pendingReplies.reserveInitialCapacity(m_pendingConnectionReplies.size());
+ for (auto& reply : m_pendingConnectionReplies)
+ pendingReplies.append(WTFMove(reply));
+
+ // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted.
+ m_processPool.networkProcessCrashed(*this, WTFMove(pendingReplies));
+}
+
+void NetworkProcessProxy::networkProcessFailedToLaunch()
+{
// The network process must have crashed or exited, send any pending sync replies we might have.
while (!m_pendingConnectionReplies.isEmpty()) {
Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
@@ -178,7 +191,13 @@
notImplemented();
#endif
}
+ clearCallbackStates();
+ // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted.
+ m_processPool.networkProcessFailedToLaunch(*this);
+}
+void NetworkProcessProxy::clearCallbackStates()
+{
for (const auto& callback : m_pendingFetchWebsiteDataCallbacks.values())
callback(WebsiteData());
m_pendingFetchWebsiteDataCallbacks.clear();
@@ -190,9 +209,6 @@
for (const auto& callback : m_pendingDeleteWebsiteDataForOriginsCallbacks.values())
callback();
m_pendingDeleteWebsiteDataForOriginsCallbacks.clear();
-
- // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted.
- m_processPool.networkProcessCrashed(this);
}
void NetworkProcessProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
@@ -223,7 +239,7 @@
m_tokenForHoldingLockedFiles = nullptr;
// This may cause us to be deleted.
- networkProcessCrashedOrFailedToLaunch();
+ networkProcessCrashed();
}
void NetworkProcessProxy::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
@@ -302,7 +318,7 @@
ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
if (IPC::Connection::identifierIsNull(connectionIdentifier)) {
- networkProcessCrashedOrFailedToLaunch();
+ networkProcessFailedToLaunch();
return;
}
Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h 2017-07-03 19:47:11 UTC (rev 219087)
@@ -86,7 +86,9 @@
void connectionWillOpen(IPC::Connection&) override;
void processWillShutDown(IPC::Connection&) override;
- void networkProcessCrashedOrFailedToLaunch();
+ void networkProcessFailedToLaunch();
+ void networkProcessCrashed();
+ void clearCallbackStates();
// ProcessThrottlerClient
void sendProcessWillSuspendImminently() override;
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2017-07-03 19:47:11 UTC (rev 219087)
@@ -490,14 +490,25 @@
return *m_networkProcess;
}
-void WebProcessPool::networkProcessCrashed(NetworkProcessProxy* networkProcessProxy)
+void WebProcessPool::networkProcessCrashed(NetworkProcessProxy& networkProcessProxy, Vector<Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>>&& pendingReplies)
{
+ networkProcessFailedToLaunch(networkProcessProxy);
+ ASSERT(!m_networkProcess);
+ if (pendingReplies.isEmpty())
+ return;
+ auto& newNetworkProcess = ensureNetworkProcess();
+ for (auto& reply : pendingReplies)
+ newNetworkProcess.getNetworkProcessConnection(WTFMove(reply));
+}
+
+void WebProcessPool::networkProcessFailedToLaunch(NetworkProcessProxy& networkProcessProxy)
+{
ASSERT(m_networkProcess);
- ASSERT(networkProcessProxy == m_networkProcess.get());
+ ASSERT(&networkProcessProxy == m_networkProcess.get());
m_didNetworkProcessCrash = true;
for (auto& supplement : m_supplements.values())
- supplement->processDidClose(networkProcessProxy);
+ supplement->processDidClose(&networkProcessProxy);
m_client.networkProcessDidCrash(this);
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (219086 => 219087)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2017-07-03 19:47:11 UTC (rev 219087)
@@ -315,7 +315,8 @@
// Network Process Management
NetworkProcessProxy& ensureNetworkProcess(WebsiteDataStore* withWebsiteDataStore = nullptr);
NetworkProcessProxy* networkProcess() { return m_networkProcess.get(); }
- void networkProcessCrashed(NetworkProcessProxy*);
+ void networkProcessCrashed(NetworkProcessProxy&, Vector<Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>>&&);
+ void networkProcessFailedToLaunch(NetworkProcessProxy&);
void getNetworkProcessConnection(Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>&&);
Modified: trunk/Tools/ChangeLog (219086 => 219087)
--- trunk/Tools/ChangeLog 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Tools/ChangeLog 2017-07-03 19:47:11 UTC (rev 219087)
@@ -1,3 +1,20 @@
+2017-07-03 Ryosuke Niwa <[email protected]>
+
+ WebContent processes crash when the network process crashes with pending connection requests
+ https://bugs.webkit.org/show_bug.cgi?id=174065
+ <rdar://problem/30359835>
+
+ Reviewed by Tim Horton.
+
+ Add a API to ensure UI process tries to relaunch a new network process when the network process
+ crashes with pending network connection requests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/NetworkProcessCrashWithPendingConnection.mm: Added.
+ * TestWebKitAPI/cocoa/TestNavigationDelegate.h:
+ * TestWebKitAPI/cocoa/TestNavigationDelegate.mm:
+ (-[TestNavigationDelegate webViewWebContentProcessDidTerminate:]): Added.
+
2017-07-03 Eric Carlson <[email protected]>
[MediaStream] Protect request and web view during gUM client callback
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (219086 => 219087)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-07-03 19:47:11 UTC (rev 219087)
@@ -513,6 +513,7 @@
9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */; };
9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9984FACD1CFFB038008D198C /* editable-body.html */; };
9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp */; };
+ 9B19CDA01F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B19CD9E1F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm */; };
9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */; };
9B270FEE1DDC2C0B002D53F3 /* closed-shadow-tree-test.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */; };
9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */; };
@@ -1390,6 +1391,7 @@
9984FACD1CFFB038008D198C /* editable-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-body.html"; sourceTree = "<group>"; };
9B0786A21C58830F00D159E3 /* InjectedBundleMakeAllShadowRootsOpen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootsOpen.cpp; sourceTree = "<group>"; };
9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMakeAllShadowRootsOpen_Bundle.cpp; sourceTree = "<group>"; };
+ 9B19CD9E1F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessCrashWithPendingConnection.mm; path = WebKit2/NetworkProcessCrashWithPendingConnection.mm; sourceTree = "<group>"; };
9B26FC6B159D061000CC3765 /* HTMLFormCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLFormCollectionNamedItem.mm; sourceTree = "<group>"; };
9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HTMLFormCollectionNamedItem.html; sourceTree = "<group>"; };
9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "closed-shadow-tree-test.html"; sourceTree = "<group>"; };
@@ -2164,6 +2166,7 @@
2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */,
B55AD1D1179F336600AC1494 /* PreventImageLoadWithAutoResizing.mm */,
B55AD1D3179F3ABF00AC1494 /* PreventImageLoadWithAutoResizing_Bundle.cpp */,
+ 9B19CD9E1F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm */,
2943BE84161DFEB800999E3D /* UserContentTest.mm */,
BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */,
BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */,
@@ -3126,6 +3129,7 @@
7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */,
A10F047E1E3AD29C00C95E19 /* NSFileManagerExtras.mm in Sources */,
+ 9B19CDA01F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm in Sources */,
37A22AA71DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm in Sources */,
7CCE7F251A411AF600447C4C /* OpenAndCloseWindow.mm in Sources */,
CEBCA12F1E3A660100C73293 /* OverrideContentSecurityPolicy.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/NetworkProcessCrashWithPendingConnection.mm (0 => 219087)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/NetworkProcessCrashWithPendingConnection.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/NetworkProcessCrashWithPendingConnection.mm 2017-07-03 19:47:11 UTC (rev 219087)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import <WebKit/WKContextPrivate.h>
+#import <WebKit/WKProcessGroupPrivate.h>
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/WebKit.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED
+
+namespace TestWebKitAPI {
+
+static bool loadedOrCrashed = false;
+static bool loaded = false;
+static bool webProcessCrashed = false;
+static bool networkProcessCrashed = false;
+
+TEST(WebKit2, NetworkProcessCrashWithPendingConnection)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ RetainPtr<WKProcessPool> processPool = adoptNS([[WKProcessPool alloc] init]);
+ [configuration setProcessPool:processPool.get()];
+
+ // FIXME: Adopt the new API once it's added in webkit.org/b/174061.
+ WKContextClientV0 client;
+ memset(&client, 0, sizeof(client));
+ client.networkProcessDidCrash = [](WKContextRef context, const void* clientInfo) {
+ networkProcessCrashed = true;
+ };
+ WKContextSetClient(static_cast<WKContextRef>(processPool.get()), &client.base);
+
+ RetainPtr<WKWebView> webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ RetainPtr<WKWebView> webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ [webView1.get() loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
+ [webView1.get() _test_waitForDidFinishNavigation];
+
+ [webView2.get() loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
+ [webView2.get() _test_waitForDidFinishNavigation];
+
+ pid_t webView1PID = [webView1.get() _webProcessIdentifier];
+ pid_t webView2PID = [webView2.get() _webProcessIdentifier];
+ EXPECT_NE(webView1PID, webView2PID);
+
+ pid_t initialNetworkProcessIdentififer = [processPool.get() _networkProcessIdentifier];
+ EXPECT_NE(initialNetworkProcessIdentififer, 0);
+ kill(initialNetworkProcessIdentififer, SIGKILL);
+ Util::run(&networkProcessCrashed);
+ networkProcessCrashed = false;
+
+ [webView1.get() loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ [webView1.get() _test_waitForDidFinishNavigation];
+
+ pid_t relaunchedNetworkProcessIdentifier = [processPool.get() _networkProcessIdentifier];
+ EXPECT_NE(initialNetworkProcessIdentififer, relaunchedNetworkProcessIdentifier);
+ EXPECT_FALSE(networkProcessCrashed);
+
+ kill(relaunchedNetworkProcessIdentifier, SIGSTOP);
+
+ [webView2.get() loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ Util::sleep(0.5); // Wait for the WebContent process to send CreateNetworkConnectionToWebProcess
+ kill(relaunchedNetworkProcessIdentifier, SIGKILL);
+ Util::run(&networkProcessCrashed);
+
+ auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
+ loadedOrCrashed = false;
+ [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) {
+ loadedOrCrashed = true;
+ loaded = true;
+ }];
+ [navigationDelegate setWebContentProcessDidTerminate:^(WKWebView *) {
+ loadedOrCrashed = true;
+ webProcessCrashed = true;
+ }];
+ [webView2 setNavigationDelegate:navigationDelegate.get()];
+ TestWebKitAPI::Util::run(&loadedOrCrashed);
+ EXPECT_TRUE(loaded);
+ EXPECT_FALSE(webProcessCrashed);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h (219086 => 219087)
--- trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h 2017-07-03 19:47:11 UTC (rev 219087)
@@ -35,6 +35,7 @@
@property (nonatomic, copy) void (^didFailProvisionalNavigation)(WKWebView *, WKNavigation *, NSError *);
@property (nonatomic, copy) void (^didFinishNavigation)(WKWebView *, WKNavigation *);
@property (nonatomic, copy) void (^renderingProgressDidChange)(WKWebView *, _WKRenderingProgressEvents);
+@property (nonatomic, copy) void (^webContentProcessDidTerminate)(WKWebView *);
- (void)waitForDidFinishNavigation;
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm (219086 => 219087)
--- trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm 2017-07-03 19:11:55 UTC (rev 219086)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm 2017-07-03 19:47:11 UTC (rev 219087)
@@ -45,6 +45,12 @@
_didFinishNavigation(webView, navigation);
}
+- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView
+{
+ if (_webContentProcessDidTerminate)
+ _webContentProcessDidTerminate(webView);
+}
+
- (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents
{
if (_renderingProgressDidChange)