Log using differential privacy domains where the WebContent process crashes
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:52:04 +0000 (20:52 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:52:04 +0000 (20:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178346
<rdar://problem/33293830>

Reviewed by Alex Christensen.

Source/WebCore:

Add new diagnostic logging key for domain causing crashes.

* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::domainCausingCrashKey):
* page/DiagnosticLoggingKeys.h:

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reload):
(WebKit::WebPageProxy::currentURL const):
(WebKit::WebPageProxy::processDidTerminate):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didClose):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebProcessProxy.cpp

index bb67f97..c30ed6d 100644 (file)
@@ -1,3 +1,17 @@
+2017-10-16  Chris Dumez  <cdumez@apple.com>
+
+        Log using differential privacy domains where the WebContent process crashes
+        https://bugs.webkit.org/show_bug.cgi?id=178346
+        <rdar://problem/33293830>
+
+        Reviewed by Alex Christensen.
+
+        Add new diagnostic logging key for domain causing crashes.
+
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey):
+        * page/DiagnosticLoggingKeys.h:
+
 2017-10-16  Sam Weinig  <sam@webkit.org>
 
         [Settings] Remove all custom code from Settings.h/cpp
index b533a78..26ae913 100644 (file)
@@ -343,6 +343,11 @@ String DiagnosticLoggingKeys::documentLoaderStoppingKey()
     return ASCIILiteral("documentLoaderStopping");
 }
 
+String DiagnosticLoggingKeys::domainCausingCrashKey()
+{
+    return ASCIILiteral("DomainCausingCrash");
+}
+
 String DiagnosticLoggingKeys::domainCausingEnergyDrainKey()
 {
     return ASCIILiteral("DomainCausingEnergyDrain");
index 911428a..21f36b8 100644 (file)
@@ -49,6 +49,7 @@ public:
     static String diskCacheKey();
     static String diskCacheAfterValidationKey();
     static String documentLoaderStoppingKey();
+    WEBCORE_EXPORT static String domainCausingCrashKey();
     static String domainCausingEnergyDrainKey();
     WEBCORE_EXPORT static String domainCausingJetsamKey();
     WEBCORE_EXPORT static String simulatedPageCrashKey();
index c56dcd4..26352f4 100644 (file)
@@ -1,3 +1,19 @@
+2017-10-16  Chris Dumez  <cdumez@apple.com>
+
+        Log using differential privacy domains where the WebContent process crashes
+        https://bugs.webkit.org/show_bug.cgi?id=178346
+        <rdar://problem/33293830>
+
+        Reviewed by Alex Christensen.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::reload):
+        (WebKit::WebPageProxy::currentURL const):
+        (WebKit::WebPageProxy::processDidTerminate):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didClose):
+
 2017-10-16  Youenn Fablet  <youenn@apple.com>
 
         Activate Cache API by default
index 0c336a1..57acf64 100644 (file)
@@ -1073,10 +1073,7 @@ RefPtr<API::Navigation> WebPageProxy::reload(OptionSet<WebCore::ReloadOption> op
 {
     SandboxExtension::Handle sandboxExtensionHandle;
 
-    String url = m_pageLoadState.activeURL();
-    if (url.isEmpty() && m_backForwardList->currentItem())
-        url = m_backForwardList->currentItem()->url();
-
+    String url = currentURL();
     if (!url.isEmpty()) {
         auto transaction = m_pageLoadState.transaction();
         m_pageLoadState.setPendingAPIRequestURL(transaction, url);
@@ -5440,16 +5437,21 @@ void WebPageProxy::didChangeProcessIsResponsive()
     m_pageLoadState.didChangeProcessIsResponsive();
 }
 
+String WebPageProxy::currentURL() const
+{
+    String url = m_pageLoadState.activeURL();
+    if (url.isEmpty() && m_backForwardList->currentItem())
+        url = m_backForwardList->currentItem()->url();
+    return url;
+}
+
 void WebPageProxy::processDidTerminate(ProcessTerminationReason reason)
 {
     ASSERT(m_isValid);
 
 #if PLATFORM(IOS)
     if (m_process->isUnderMemoryPressure()) {
-        String url = m_pageLoadState.activeURL();
-        if (url.isEmpty() && m_backForwardList->currentItem())
-            url = m_backForwardList->currentItem()->url();
-        String domain = WebCore::topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, url).host());
+        String domain = WebCore::topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, currentURL()).host());
         if (!domain.isEmpty())
             logDiagnosticMessageWithEnhancedPrivacy(WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey(), domain, WebCore::ShouldSample::No);
     }
index c87d230..9a4bdc5 100644 (file)
@@ -423,6 +423,8 @@ public:
     bool drawsBackground() const { return m_drawsBackground; }
     void setDrawsBackground(bool);
 
+    String currentURL() const;
+
     float topContentInset() const { return m_topContentInset; }
     void setTopContentInset(float);
 
index bc797c7..656845a 100644 (file)
@@ -50,6 +50,7 @@
 #include "WebUserContentControllerProxy.h"
 #include "WebsiteData.h"
 #include <WebCore/DiagnosticLoggingKeys.h>
+#include <WebCore/PublicSuffix.h>
 #include <WebCore/SuddenTermination.h>
 #include <WebCore/URL.h>
 #include <stdio.h>
@@ -626,6 +627,15 @@ void WebProcessProxy::didClose(IPC::Connection&)
 
     shutDown();
 
+#if ENABLE(PUBLIC_SUFFIX_LIST)
+    if (pages.size() == 1) {
+        auto& page = *pages[0];
+        String domain = topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, page.currentURL()).host());
+        if (!domain.isEmpty())
+            page.logDiagnosticMessageWithEnhancedPrivacy(WebCore::DiagnosticLoggingKeys::domainCausingCrashKey(), domain, WebCore::ShouldSample::No);
+    }
+#endif
+
     for (auto& page : pages)
         page->processDidTerminate(ProcessTerminationReason::Crash);