Skip to content
Permalink
Browse files
Log using differential privacy domains where the WebContent process c…
…rashes

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):


Canonical link: https://commits.webkit.org/194578@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Oct 16, 2017
1 parent 3eb5fe0 commit fa50e2476144ff91ae037f2ef5e09edf43a59608
@@ -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
@@ -343,6 +343,11 @@ String DiagnosticLoggingKeys::documentLoaderStoppingKey()
return ASCIILiteral("documentLoaderStopping");
}

String DiagnosticLoggingKeys::domainCausingCrashKey()
{
return ASCIILiteral("DomainCausingCrash");
}

String DiagnosticLoggingKeys::domainCausingEnergyDrainKey()
{
return ASCIILiteral("DomainCausingEnergyDrain");
@@ -49,6 +49,7 @@ class DiagnosticLoggingKeys {
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();
@@ -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
@@ -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);
}
@@ -423,6 +423,8 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
bool drawsBackground() const { return m_drawsBackground; }
void setDrawsBackground(bool);

String currentURL() const;

float topContentInset() const { return m_topContentInset; }
void setTopContentInset(float);

@@ -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);

0 comments on commit fa50e24

Please sign in to comment.