Title: [277533] trunk/Tools
Revision
277533
Author
jbed...@apple.com
Date
2021-05-14 22:02:06 -0700 (Fri, 14 May 2021)

Log Message

[WebKitTestRunner] Forward WebContent termination reason
https://bugs.webkit.org/show_bug.cgi?id=225818
<rdar://problem/78027164>

Reviewed by Chris Dumez.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage): Use didTerminate callback instead of didCrash callback.
(WTR::TestController::createWebViewWithOptions): Ditto.
(WTR::TestController::webProcessDidTerminate):
(WTR::TestController::processDidCrash): Renamed webProcessDidTerminate.
* WebKitTestRunner/TestController.h: Replace processDidCrash with webProcessDidTerminate.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformRunUntil):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (277532 => 277533)


--- trunk/Tools/ChangeLog	2021-05-15 04:59:10 UTC (rev 277532)
+++ trunk/Tools/ChangeLog	2021-05-15 05:02:06 UTC (rev 277533)
@@ -1,5 +1,22 @@
 2021-05-14  Jonathan Bedard  <jbed...@apple.com>
 
+        [WebKitTestRunner] Forward WebContent termination reason
+        https://bugs.webkit.org/show_bug.cgi?id=225818
+        <rdar://problem/78027164>
+
+        Reviewed by Chris Dumez.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage): Use didTerminate callback instead of didCrash callback.
+        (WTR::TestController::createWebViewWithOptions): Ditto.
+        (WTR::TestController::webProcessDidTerminate):
+        (WTR::TestController::processDidCrash): Renamed webProcessDidTerminate.
+        * WebKitTestRunner/TestController.h: Replace processDidCrash with webProcessDidTerminate.
+        * WebKitTestRunner/win/TestControllerWin.cpp:
+        (WTR::TestController::platformRunUntil):
+
+2021-05-14  Jonathan Bedard  <jbed...@apple.com>
+
         [run-webkit-tests] Handle missing simulator state plist
         https://bugs.webkit.org/show_bug.cgi?id=225833
         <rdar://problem/78036930>

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (277532 => 277533)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2021-05-15 04:59:10 UTC (rev 277532)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2021-05-15 05:02:06 UTC (rev 277533)
@@ -468,13 +468,13 @@
         nullptr, // renderingProgressDidChange
         canAuthenticateAgainstProtectionSpace,
         didReceiveAuthenticationChallenge,
-        processDidCrash,
+        nullptr, // webProcessDidCrash
         copyWebCryptoMasterKey,
         didBeginNavigationGesture,
         willEndNavigationGesture,
         didEndNavigationGesture,
         didRemoveNavigationGestureSnapshot,
-        nullptr, // webProcessDidTerminate
+        webProcessDidTerminate, // webProcessDidTerminate
         nullptr, // contentRuleListNotification
         copySignedPublicKeyAndChallengeString,
         navigationActionDidBecomeDownload,
@@ -810,13 +810,13 @@
         nullptr, // renderingProgressDidChange
         canAuthenticateAgainstProtectionSpace,
         didReceiveAuthenticationChallenge,
-        processDidCrash,
+        nullptr,
         copyWebCryptoMasterKey,
         didBeginNavigationGesture,
         willEndNavigationGesture,
         didEndNavigationGesture,
         didRemoveNavigationGestureSnapshot,
-        nullptr, // webProcessDidTerminate
+        webProcessDidTerminate, // webProcessDidTerminate
         nullptr, // contentRuleListNotification
         copySignedPublicKeyAndChallengeString,
         navigationActionDidBecomeDownload,
@@ -1862,9 +1862,9 @@
     static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallenge(page, /*frame,*/ authenticationChallenge);
 }
 
-void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
+void TestController::webProcessDidTerminate(WKPageRef page, WKProcessTerminationReason reason, const void* clientInfo)
 {
-    static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash();
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->webProcessDidTerminate(reason);
 }
 
 void TestController::didBeginNavigationGesture(WKPageRef page, const void *clientInfo)
@@ -2154,12 +2154,35 @@
     static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallenge(nullptr, authenticationChallenge);
 }
 
-void TestController::processDidCrash()
+void TestController::webProcessDidTerminate(WKProcessTerminationReason reason)
 {
     // This function can be called multiple times when crash logs are being saved on Windows, so
     // ensure we only print the crashed message once.
     if (!m_didPrintWebProcessCrashedMessage) {
         pid_t pid = WKPageGetProcessIdentifier(m_mainWebView->page());
+        fprintf(stderr, "%s terminated (pid %ld) ", webProcessName(), static_cast<long>(pid));
+        switch (reason) {
+        case kWKProcessTerminationReasonExceededMemoryLimit:
+            fprintf(stderr, "because the memory limit was exceeded\n");
+            break;
+        case kWKProcessTerminationReasonExceededCPULimit:
+            fprintf(stderr, "because the cpu limit was exceeded\n");
+            break;
+        case kWKProcessTerminationReasonRequestedByClient:
+            fprintf(stderr, "because the client requested\n");
+            break;
+        case kWKProcessTerminationReasonCrash:
+            fprintf(stderr, "because the process crashed\n");
+            break;
+        default:
+            fprintf(stderr, "for an unknown reason\n");
+        }
+
+        if (reason == kWKProcessTerminationReasonRequestedByClient) {
+            fflush(stderr);
+            return;
+        }
+
         fprintf(stderr, "#CRASHED - %s (pid %ld)\n", webProcessName(), static_cast<long>(pid));
         fflush(stderr);
         m_didPrintWebProcessCrashedMessage = true;

Modified: trunk/Tools/WebKitTestRunner/TestController.h (277532 => 277533)


--- trunk/Tools/WebKitTestRunner/TestController.h	2021-05-15 04:59:10 UTC (rev 277532)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2021-05-15 05:02:06 UTC (rev 277533)
@@ -469,8 +469,8 @@
     bool downloadDidReceiveServerRedirectToURL(WKDownloadRef, WKURLRequestRef);
     static void downloadDidReceiveAuthenticationChallenge(WKDownloadRef, WKAuthenticationChallengeRef, const void *clientInfo);
     
-    static void processDidCrash(WKPageRef, const void* clientInfo);
-    void processDidCrash();
+    static void webProcessDidTerminate(WKPageRef,  WKProcessTerminationReason, const void* clientInfo);
+    void webProcessDidTerminate(WKProcessTerminationReason);
 
     static void didBeginNavigationGesture(WKPageRef, const void*);
     static void willEndNavigationGesture(WKPageRef, WKBackForwardListItemRef, const void*);

Modified: trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp (277532 => 277533)


--- trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp	2021-05-15 04:59:10 UTC (rev 277532)
+++ trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp	2021-05-15 05:02:06 UTC (rev 277533)
@@ -155,7 +155,7 @@
     // First, let the test harness know this happened so it won't think we've hung. But
     // make sure we don't exit just yet!
     m_shouldExitWhenWebProcessCrashes = false;
-    processDidCrash();
+    webProcessDidTerminate(kWKProcessTerminationReasonCrash);
     m_shouldExitWhenWebProcessCrashes = true;
 
     // Then spin a run loop until it finishes crashing to give time for a crash log to be saved. If
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to