Title: [179754] trunk
Revision
179754
Author
[email protected]
Date
2015-02-06 13:21:08 -0800 (Fri, 06 Feb 2015)

Log Message

Report network process crashes during layout tests
https://bugs.webkit.org/show_bug.cgi?id=139646

Reviewed by Anders Carlsson.

Source/WebKit2:

Added a way to get network process pid, modeled after how we do this for web process.

* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextGetNetworkProcessIdentifier):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::networkProcessCrashed): Don't reset m_networkProcess until
after calling the client, so that the client could retrieve its pid.
(WebKit::WebProcessPool::networkProcessIdentifier):
* UIProcess/WebProcessPool.h:

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
(WTR::TestController::networkProcessName):
(WTR::TestController::networkProcessDidCrash):
* WebKitTestRunner/TestController.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179753 => 179754)


--- trunk/Source/WebKit2/ChangeLog	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-06 21:21:08 UTC (rev 179754)
@@ -1,3 +1,21 @@
+2015-02-06  Alexey Proskuryakov  <[email protected]>
+
+        Report network process crashes during layout tests
+        https://bugs.webkit.org/show_bug.cgi?id=139646
+
+        Reviewed by Anders Carlsson.
+
+        Added a way to get network process pid, modeled after how we do this for web process.
+
+        * UIProcess/API/C/mac/WKContextPrivateMac.h:
+        * UIProcess/API/C/mac/WKContextPrivateMac.mm:
+        (WKContextGetNetworkProcessIdentifier):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::networkProcessCrashed): Don't reset m_networkProcess until
+        after calling the client, so that the client could retrieve its pid.
+        (WebKit::WebProcessPool::networkProcessIdentifier):
+        * UIProcess/WebProcessPool.h:
+
 2015-02-05  Timothy Hatcher  <[email protected]>
 
         Support overriding the deviceScaleFactor per WKWebView/WKView

Modified: trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h (179753 => 179754)


--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h	2015-02-06 21:21:08 UTC (rev 179754)
@@ -70,6 +70,8 @@
 WK_EXPORT bool WKContextShouldBlockWebGL();
 WK_EXPORT bool WKContextShouldSuggestBlockWebGL();
 
+WK_EXPORT pid_t WKContextGetNetworkProcessIdentifier(WKContextRef context);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm (179753 => 179754)


--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm	2015-02-06 21:21:08 UTC (rev 179754)
@@ -146,3 +146,13 @@
 {
     return WKShouldSuggestBlockingWebGL();
 }
+
+pid_t WKContextGetNetworkProcessIdentifier(WKContextRef contextRef)
+{
+#if ENABLE(NETWORK_PROCESS)
+    return toImpl(contextRef)->networkProcessIdentifier();
+#else
+    UNUSED_PARAM(contextRef);
+    return 0;
+#endif
+}

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (179753 => 179754)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-02-06 21:21:08 UTC (rev 179754)
@@ -448,9 +448,10 @@
     for (; it != end; ++it)
         it->value->processDidClose(networkProcessProxy);
 
+    m_client.networkProcessDidCrash(this);
+
+    // Leave the process proxy around during client call, so that the client could query the process identifier.
     m_networkProcess = nullptr;
-
-    m_client.networkProcessDidCrash(this);
 }
 
 void WebProcessPool::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply)
@@ -939,6 +940,16 @@
 }
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
+#if ENABLE(NETWORK_PROCESS)
+PlatformProcessIdentifier WebProcessPool::networkProcessIdentifier()
+{
+    if (!m_networkProcess)
+        return 0;
+
+    return m_networkProcess->processIdentifier();
+}
+#endif
+
 void WebProcessPool::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
 {
     m_alwaysUsesComplexTextCodePath = alwaysUseComplexText;

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (179753 => 179754)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2015-02-06 21:21:08 UTC (rev 179754)
@@ -187,6 +187,10 @@
     PluginInfoStore& pluginInfoStore() { return m_pluginInfoStore; }
 #endif
 
+#if ENABLE(NETWORK_PROCESS)
+    PlatformProcessIdentifier networkProcessIdentifier();
+#endif
+
     void setAlwaysUsesComplexTextCodePath(bool);
     void setShouldUseFontSmoothing(bool);
     

Modified: trunk/Tools/ChangeLog (179753 => 179754)


--- trunk/Tools/ChangeLog	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Tools/ChangeLog	2015-02-06 21:21:08 UTC (rev 179754)
@@ -1,3 +1,16 @@
+2015-02-06  Alexey Proskuryakov  <[email protected]>
+
+        Report network process crashes during layout tests
+        https://bugs.webkit.org/show_bug.cgi?id=139646
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        (WTR::TestController::networkProcessName):
+        (WTR::TestController::networkProcessDidCrash):
+        * WebKitTestRunner/TestController.h:
+
 2015-02-06  Csaba Osztrogonác  <[email protected]>
 
         run-jsc-stress-tests --remote should create remote directory before copying the bundle

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (179753 => 179754)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-02-06 21:21:08 UTC (rev 179754)
@@ -56,6 +56,7 @@
 #include <wtf/text/CString.h>
 
 #if PLATFORM(COCOA)
+#include <WebKit/WKContextPrivateMac.h>
 #include <WebKit/WKPagePrivateMac.h>
 #endif
 
@@ -391,6 +392,15 @@
     };
     WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient.base);
 
+    WKContextClientV1 contextClient = {
+        { 1, this },
+        0, // plugInAutoStartOriginHashesChanged
+        networkProcessDidCrash,
+        0, // plugInInformationBecameAvailable
+        0, // copyWebCryptoMasterKey
+    };
+    WKContextSetClient(m_context.get(), &contextClient.base);
+
     WKContextHistoryClientV0 historyClient = {
         { 0, this },
         didNavigateWithNavigationData,
@@ -691,6 +701,18 @@
 #endif
 }
 
+const char* TestController::networkProcessName()
+{
+    // FIXME: Find a way to not hardcode the process name.
+#if PLATFORM(IOS)
+    return "com.apple.WebKit.Networking";
+#elif PLATFORM(MAC)
+    return "com.apple.WebKit.Networking.Development";
+#else
+    return "NetworkProcess";
+#endif
+}
+
 void TestController::updateWebViewSizeForTest(const TestInvocation& test)
 {
     bool isSVGW3CTest = strstr(test.pathOrURL(), "svg/W3C-SVG-1.1") || strstr(test.pathOrURL(), "svg\\W3C-SVG-1.1");
@@ -916,6 +938,11 @@
     *returnData = static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody).leakRef();
 }
 
+void TestController::networkProcessDidCrash(WKContextRef context, const void *clientInfo)
+{
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->networkProcessDidCrash();
+}
+
 void TestController::didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous)
 {
     WKRetainPtr<WKStringRef> keyKey = adoptWK(WKStringCreateWithUTF8CString("Key"));
@@ -1200,6 +1227,19 @@
     return m_currentInvocation->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody);
 }
 
+// WKContextClient
+
+void TestController::networkProcessDidCrash()
+{
+#if PLATFORM(COCOA)
+    pid_t pid = WKContextGetNetworkProcessIdentifier(m_context.get());
+    fprintf(stderr, "#CRASHED - %s (pid %ld)\n", networkProcessName(), static_cast<long>(pid));
+#else
+    fprintf(stderr, "#CRASHED - %s\n", networkProcessName());
+#endif
+    exit(1);
+}
+
 // WKPageNavigationClient
 
 void TestController::didCommitNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef, const void* clientInfo)

Modified: trunk/Tools/WebKitTestRunner/TestController.h (179753 => 179754)


--- trunk/Tools/WebKitTestRunner/TestController.h	2015-02-06 20:57:45 UTC (rev 179753)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2015-02-06 21:21:08 UTC (rev 179754)
@@ -105,6 +105,7 @@
     void reattachPageToWebProcess();
 
     static const char* webProcessName();
+    static const char* networkProcessName();
 
     WorkQueueManager& workQueueManager() { return m_workQueueManager; }
 
@@ -150,6 +151,10 @@
 
     void didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous);
 
+    // WKContextClient
+    static void networkProcessDidCrash(WKContextRef, const void*);
+    void networkProcessDidCrash();
+
     // WKPageNavigationClient
     static void didCommitNavigation(WKPageRef, WKNavigationRef, WKTypeRef userData, const void*);
     void didCommitNavigation(WKPageRef, WKNavigationRef);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to