Diff
Modified: trunk/Source/WebCore/ChangeLog (278787 => 278788)
--- trunk/Source/WebCore/ChangeLog 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/ChangeLog 2021-06-11 23:13:05 UTC (rev 278788)
@@ -1,3 +1,48 @@
+2021-06-11 Chris Dumez <cdu...@apple.com>
+
+ Enable more release logging in WebCore for ephemeral sessions
+ https://bugs.webkit.org/show_bug.cgi?id=226940
+
+ Reviewed by Geoffrey Garen.
+
+ Enable more release logging in WebCore for ephemeral sessions, to faciliate
+ debugging.
+
+ * Modules/webaudio/AudioContext.cpp:
+ * loader/PolicyChecker.cpp:
+ (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scheduleResizeEventIfNeeded):
+ (WebCore::FrameView::paintContents):
+ (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
+ * page/PerformanceMonitor.cpp:
+ (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
+ (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
+ (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
+ (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
+ (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
+ * workers/service/ServiceWorker.cpp:
+ (WebCore::ServiceWorker::ServiceWorker):
+ (WebCore::ServiceWorker::updateState):
+ (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const): Deleted.
+ * workers/service/ServiceWorker.h:
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::addRegistration):
+ (WebCore::ServiceWorkerContainer::unregisterRegistration):
+ (WebCore::ServiceWorkerContainer::updateRegistration):
+ (WebCore::ServiceWorkerContainer::jobFailedWithException):
+ (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
+ (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
+ (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
+ (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
+ (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
+ (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const): Deleted.
+ * workers/service/ServiceWorkerContainer.h:
+ * workers/service/ServiceWorkerRegistration.cpp:
+ (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
+ (WebCore::ServiceWorkerRegistration::updateStateFromServer):
+ (WebCore::ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent):
+
2021-06-11 Patrick Angle <pan...@apple.com>
Web Inspector: Add instrumentation to node destruction for InspectorDOMAgent
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (278787 => 278788)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -55,7 +55,7 @@
namespace WebCore {
-#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document() && document()->page() && document()->page()->isAlwaysOnLoggingAllowed(), Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
+#define AUDIOCONTEXT_RELEASE_LOG(fmt, ...) RELEASE_LOG(Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
#if OS(WINDOWS)
// Don't allow more than this number of simultaneous AudioContexts talking to hardware.
Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (278787 => 278788)
--- trunk/Source/WebCore/loader/PolicyChecker.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -54,10 +54,9 @@
#include "QuickLook.h"
#endif
-#define IS_ALLOWED (m_frame.page() ? m_frame.page()->sessionID().isAlwaysOnLoggingAllowed() : false)
#define PAGE_ID (m_frame.loader().pageID().value_or(PageIdentifier()).toUInt64())
#define FRAME_ID (m_frame.loader().frameID().value_or(FrameIdentifier()).toUInt64())
-#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(IS_ALLOWED, Loading, "%p - [pageID=%" PRIu64 ", frameID=%" PRIu64 "] PolicyChecker::" fmt, this, PAGE_ID, FRAME_ID, ##__VA_ARGS__)
+#define POLICYCHECKER_RELEASE_LOG(fmt, ...) RELEASE_LOG(Loading, "%p - [pageID=%" PRIu64 ", frameID=%" PRIu64 "] PolicyChecker::" fmt, this, PAGE_ID, FRAME_ID, ##__VA_ARGS__)
namespace WebCore {
@@ -138,9 +137,9 @@
// This avoids confusion on the part of the client.
if (equalIgnoringHeaderFields(request, loader->lastCheckedRequest()) || (!request.isNull() && request.url().isEmpty())) {
if (!request.isNull() && request.url().isEmpty())
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because the URL is empty");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because the URL is empty");
else
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because the URL is the same as the last request");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because the URL is the same as the last request");
function(ResourceRequest(request), { }, NavigationPolicyDecision::ContinueLoad);
loader->setLastCheckedRequest(WTFMove(request));
return;
@@ -158,9 +157,9 @@
if (isBackForwardLoadType(m_loadType))
m_loadType = FrameLoadType::Reload;
if (shouldContinue)
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because we have valid substitute data");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because we have valid substitute data");
else
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: not continuing with substitute data because the content filter told us not to");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: not continuing with substitute data because the content filter told us not to");
function(WTFMove(request), { }, shouldContinue ? NavigationPolicyDecision::ContinueLoad : NavigationPolicyDecision::IgnoreLoad);
return;
@@ -172,7 +171,7 @@
// reveal that the frame was blocked. This way, it looks like any other cross-origin page load.
m_frame.ownerElement()->dispatchEvent(Event::create(eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because disallowed by content security policy");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: ignoring because disallowed by content security policy");
function(WTFMove(request), { }, NavigationPolicyDecision::IgnoreLoad);
return;
}
@@ -182,7 +181,7 @@
#if USE(QUICK_LOOK)
// Always allow QuickLook-generated URLs based on the protocol scheme.
if (!request.isNull() && isQuickLookPreviewURL(request.url())) {
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because quicklook-generated URL");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because quicklook-generated URL");
return function(WTFMove(request), makeWeakPtr(formState.get()), NavigationPolicyDecision::ContinueLoad);
}
#endif
@@ -194,7 +193,7 @@
if (unblocked)
frame->loader().reload();
});
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because ContentFilterUnblockHandler can handle the request");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: ignoring because ContentFilterUnblockHandler can handle the request");
return function({ }, nullptr, NavigationPolicyDecision::IgnoreLoad);
}
m_contentFilterUnblockHandler = { };
@@ -211,7 +210,7 @@
FramePolicyFunction decisionHandler = [this, function = WTFMove(function), request = ResourceRequest(request), formState = std::exchange(formState, nullptr), suggestedFilename = WTFMove(suggestedFilename),
blobURLLifetimeExtension = WTFMove(blobURLLifetimeExtension), requestIdentifier, isInitialEmptyDocumentLoad] (PolicyAction policyAction, PolicyCheckIdentifier responseIdentifier) mutable {
if (!responseIdentifier.isValidFor(requestIdentifier)) {
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because response is not valid for request");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: ignoring because response is not valid for request");
return function({ }, nullptr, NavigationPolicyDecision::IgnoreLoad);
}
@@ -223,22 +222,22 @@
m_frame.loader().client().startDownload(request, suggestedFilename);
FALLTHROUGH;
case PolicyAction::Ignore:
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because policyAction from dispatchDecidePolicyForNavigationAction is Ignore");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: ignoring because policyAction from dispatchDecidePolicyForNavigationAction is Ignore");
return function({ }, nullptr, NavigationPolicyDecision::IgnoreLoad);
case PolicyAction::StopAllLoads:
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: stopping because policyAction from dispatchDecidePolicyForNavigationAction is StopAllLoads");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: stopping because policyAction from dispatchDecidePolicyForNavigationAction is StopAllLoads");
function({ }, nullptr, NavigationPolicyDecision::StopAllLoads);
return;
case PolicyAction::Use:
if (!m_frame.loader().client().canHandleRequest(request)) {
handleUnimplementablePolicy(m_frame.loader().client().cannotShowURLError(request));
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because frame loader client can't handle the request");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: ignoring because frame loader client can't handle the request");
return function({ }, { }, NavigationPolicyDecision::IgnoreLoad);
}
if (isInitialEmptyDocumentLoad)
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because this is an initial empty document");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because this is an initial empty document");
else
- RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because this policyAction from dispatchDecidePolicyForNavigationAction is Use");
+ POLICYCHECKER_RELEASE_LOG("checkNavigationPolicy: continuing because this policyAction from dispatchDecidePolicyForNavigationAction is Use");
return function(WTFMove(request), makeWeakPtr(formState.get()), NavigationPolicyDecision::ContinueLoad);
}
ASSERT_NOT_REACHED();
@@ -311,4 +310,4 @@
#undef IS_ALLOWED
#undef PAGE_ID
#undef FRAME_ID
-#undef RELEASE_LOG_IF_ALLOWED
+#undef POLICYCHECKER_RELEASE_LOG
Modified: trunk/Source/WebCore/page/FrameView.cpp (278787 => 278788)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -137,7 +137,7 @@
#define PAGE_ID frame().pageID().value_or(PageIdentifier()).toUInt64()
#define FRAME_ID frame().frameID().value_or(FrameIdentifier()).toUInt64()
-#define FRAMEVIEW_RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(frame().page() && frame().page()->sessionID().isAlwaysOnLoggingAllowed(), channel, "%p - [pageID=%" PRIu64 ", frameID=%" PRIu64 ", main=%d] FrameView::" fmt, this, PAGE_ID, FRAME_ID, frame().isMainFrame(), ##__VA_ARGS__)
+#define FRAMEVIEW_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - [pageID=%" PRIu64 ", frameID=%" PRIu64 ", main=%d] FrameView::" fmt, this, PAGE_ID, FRAME_ID, frame().isMainFrame(), ##__VA_ARGS__)
namespace WebCore {
@@ -3407,7 +3407,7 @@
auto* document = frame().document();
if (document->quirks().shouldSilenceWindowResizeEvents()) {
- FRAMEVIEW_RELEASE_LOG_IF_ALLOWED(Events, "scheduleResizeEventIfNeeded: Not firing resize events because they are temporarily disabled for this page");
+ FRAMEVIEW_RELEASE_LOG(Events, "scheduleResizeEventIfNeeded: Not firing resize events because they are temporarily disabled for this page");
return;
}
@@ -4305,7 +4305,7 @@
ASSERT(!needsLayout());
if (needsLayout()) {
- FRAMEVIEW_RELEASE_LOG_IF_ALLOWED(Layout, "paintContents: Not painting because render tree needs layout");
+ FRAMEVIEW_RELEASE_LOG(Layout, "paintContents: Not painting because render tree needs layout");
return;
}
@@ -5319,7 +5319,7 @@
if (milestonesAchieved && frame().isMainFrame()) {
if (milestonesAchieved.contains(DidFirstVisuallyNonEmptyLayout))
- FRAMEVIEW_RELEASE_LOG_IF_ALLOWED(Layout, "fireLayoutRelatedMilestonesIfNeeded: Firing first visually non-empty layout milestone on the main frame");
+ FRAMEVIEW_RELEASE_LOG(Layout, "fireLayoutRelatedMilestonesIfNeeded: Firing first visually non-empty layout milestone on the main frame");
frame().loader().didReachLayoutMilestone(milestonesAchieved);
}
}
Modified: trunk/Source/WebCore/page/PerformanceMonitor.cpp (278787 => 278788)
--- trunk/Source/WebCore/page/PerformanceMonitor.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/page/PerformanceMonitor.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -39,7 +39,7 @@
namespace WebCore {
-#define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(m_page.sessionID().isAlwaysOnLoggingAllowed(), channel, "%p - PerformanceMonitor::" fmt, this, ##__VA_ARGS__)
+#define PERFMONITOR_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - PerformanceMonitor::" fmt, this, ##__VA_ARGS__)
static constexpr const Seconds cpuUsageMeasurementDelay { 5_s };
static constexpr const Seconds postLoadCPUUsageMeasurementDuration { 10_s };
@@ -184,7 +184,7 @@
return;
double cpuUsage = cpuTime.value().percentageCPUUsageSince(*m_postLoadCPUTime);
- RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostLoadCPUUsage: Process was using %.1f%% CPU after the page load.", cpuUsage);
+ PERFMONITOR_RELEASE_LOG(PerformanceLogging, "measurePostLoadCPUUsage: Process was using %.1f%% CPU after the page load.", cpuUsage);
m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageLoadCPUUsageKey(), DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
if (cpuUsage > postPageLoadCPUUsageDomainReportingThreshold)
@@ -200,7 +200,7 @@
if (!memoryUsage)
return;
- RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostLoadMemoryUsage: Process was using %llu bytes of memory after the page load.", memoryUsage.value());
+ PERFMONITOR_RELEASE_LOG(PerformanceLogging, "measurePostLoadMemoryUsage: Process was using %llu bytes of memory after the page load.", memoryUsage.value());
m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageLoadMemoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
// On iOS, we report actual Jetsams instead.
@@ -219,7 +219,7 @@
if (!memoryUsage)
return;
- RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostBackgroundingMemoryUsage: Process was using %llu bytes of memory after becoming non visible.", memoryUsage.value());
+ PERFMONITOR_RELEASE_LOG(PerformanceLogging, "measurePostBackgroundingMemoryUsage: Process was using %llu bytes of memory after becoming non visible.", memoryUsage.value());
m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
}
@@ -241,7 +241,7 @@
return;
double cpuUsage = cpuTime.value().percentageCPUUsageSince(*m_postBackgroundingCPUTime);
- RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostBackgroundingCPUUsage: Process was using %.1f%% CPU after becoming non visible.", cpuUsage);
+ PERFMONITOR_RELEASE_LOG(PerformanceLogging, "measurePostBackgroundingCPUUsage: Process was using %.1f%% CPU after becoming non visible.", cpuUsage);
m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey(), DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
}
@@ -288,7 +288,7 @@
#if !RELEASE_LOG_DISABLED
double cpuUsage = cpuTime.value().percentageCPUUsageSince(*m_perActivityStateCPUTime);
- RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measureCPUUsageInActivityState: Process is using %.1f%% CPU in state: %s", cpuUsage, stringForCPUSamplingActivityState(activityState));
+ PERFMONITOR_RELEASE_LOG(PerformanceLogging, "measureCPUUsageInActivityState: Process is using %.1f%% CPU in state: %s", cpuUsage, stringForCPUSamplingActivityState(activityState));
#endif
m_page.chrome().client().reportProcessCPUTime((cpuTime.value().systemTime + cpuTime.value().userTime) - (m_perActivityStateCPUTime.value().systemTime + m_perActivityStateCPUTime.value().userTime), activityState);
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (278787 => 278788)
--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -45,8 +45,8 @@
#include <wtf/IsoMallocInlines.h>
#include <wtf/NeverDestroyed.h>
-#define WORKER_RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorker::" fmt, this, ##__VA_ARGS__)
-#define WORKER_RELEASE_LOG_ERROR_IF_ALLOWED(fmt, ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorker::" fmt, this, ##__VA_ARGS__)
+#define WORKER_RELEASE_LOG(fmt, ...) RELEASE_LOG(ServiceWorker, "%p - ServiceWorker::" fmt, this, ##__VA_ARGS__)
+#define WORKER_RELEASE_LOG_ERROR(fmt, ...) RELEASE_LOG_ERROR(ServiceWorker, "%p - ServiceWorker::" fmt, this, ##__VA_ARGS__)
namespace WebCore {
@@ -70,7 +70,7 @@
relaxAdoptionRequirement();
updatePendingActivityForEventDispatch();
- WORKER_RELEASE_LOG_IF_ALLOWED("serviceWorkerID=%llu, state=%hhu", identifier().toUInt64(), m_data.state);
+ WORKER_RELEASE_LOG("serviceWorkerID=%llu, state=%hhu", identifier().toUInt64(), m_data.state);
}
ServiceWorker::~ServiceWorker()
@@ -81,7 +81,7 @@
void ServiceWorker::updateState(State state)
{
- WORKER_RELEASE_LOG_IF_ALLOWED("updateState: Updating service worker %llu state from %hhu to %hhu. registrationID=%llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
+ WORKER_RELEASE_LOG("updateState: Updating service worker %llu state from %hhu to %hhu. registrationID=%llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
m_data.state = state;
if (state != State::Installing && !m_isStopped) {
ASSERT(m_pendingActivityForEventDispatch);
@@ -163,19 +163,6 @@
m_pendingActivityForEventDispatch = makePendingActivity(*this);
}
-bool ServiceWorker::isAlwaysOnLoggingAllowed() const
-{
- auto* context = scriptExecutionContext();
- if (!context)
- return false;
-
- auto* container = context->serviceWorkerContainer();
- if (!container)
- return false;
-
- return container->isAlwaysOnLoggingAllowed();
-}
-
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.h (278787 => 278788)
--- trunk/Source/WebCore/workers/service/ServiceWorker.h 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.h 2021-06-11 23:13:05 UTC (rev 278788)
@@ -82,8 +82,6 @@
const char* activeDOMObjectName() const final;
void stop() final;
- bool isAlwaysOnLoggingAllowed() const;
-
SWClientConnection& swConnection();
ServiceWorkerData m_data;
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (278787 => 278788)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -58,8 +58,8 @@
#include <wtf/Scope.h>
#include <wtf/URL.h>
-#define CONTAINER_RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorkerContainer::" fmt, this, ##__VA_ARGS__)
-#define CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED(fmt, ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorkerContainer::" fmt, this, ##__VA_ARGS__)
+#define CONTAINER_RELEASE_LOG(fmt, ...) RELEASE_LOG(ServiceWorker, "%p - ServiceWorkerContainer::" fmt, this, ##__VA_ARGS__)
+#define CONTAINER_RELEASE_LOG_ERROR(fmt, ...) RELEASE_LOG_ERROR(ServiceWorker, "%p - ServiceWorkerContainer::" fmt, this, ##__VA_ARGS__)
namespace WebCore {
@@ -142,13 +142,13 @@
jobData.scriptURL = context->completeURL(relativeScriptURL);
if (!jobData.scriptURL.isValid()) {
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: Invalid scriptURL");
+ CONTAINER_RELEASE_LOG_ERROR("addRegistration: Invalid scriptURL");
promise->reject(Exception { TypeError, "serviceWorker.register() must be called with a valid relative script URL"_s });
return;
}
if (!jobData.scriptURL.protocolIsInHTTPFamily()) {
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: Invalid scriptURL scheme is not HTTP or HTTPS");
+ CONTAINER_RELEASE_LOG_ERROR("addRegistration: Invalid scriptURL scheme is not HTTP or HTTPS");
promise->reject(Exception { TypeError, "serviceWorker.register() must be called with a script URL whose protocol is either HTTP or HTTPS"_s });
return;
}
@@ -155,7 +155,7 @@
auto path = jobData.scriptURL.path();
if (path.containsIgnoringASCIICase("%2f") || path.containsIgnoringASCIICase("%5c")) {
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: scriptURL contains invalid character");
+ CONTAINER_RELEASE_LOG_ERROR("addRegistration: scriptURL contains invalid character");
promise->reject(Exception { TypeError, "serviceWorker.register() must be called with a script URL whose path does not contain '%2f' or '%5c'"_s });
return;
}
@@ -166,7 +166,7 @@
jobData.scopeURL = URL(jobData.scriptURL, "./");
if (!jobData.scopeURL.isNull() && !jobData.scopeURL.protocolIsInHTTPFamily()) {
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: scopeURL scheme is not HTTP or HTTPS");
+ CONTAINER_RELEASE_LOG_ERROR("addRegistration: scopeURL scheme is not HTTP or HTTPS");
promise->reject(Exception { TypeError, "Scope URL provided to serviceWorker.register() must be either HTTP or HTTPS"_s });
return;
}
@@ -173,12 +173,12 @@
path = jobData.scopeURL.path();
if (path.containsIgnoringASCIICase("%2f") || path.containsIgnoringASCIICase("%5c")) {
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: scopeURL contains invalid character");
+ CONTAINER_RELEASE_LOG_ERROR("addRegistration: scopeURL contains invalid character");
promise->reject(Exception { TypeError, "Scope URL provided to serviceWorker.register() cannot have a path that contains '%2f' or '%5c'"_s });
return;
}
- CONTAINER_RELEASE_LOG_IF_ALLOWED("addRegistration: Registering service worker. jobID=%" PRIu64, jobData.identifier().jobIdentifier.toUInt64());
+ CONTAINER_RELEASE_LOG("addRegistration: Registering service worker. jobID=%" PRIu64, jobData.identifier().jobIdentifier.toUInt64());
jobData.clientCreationURL = context->url();
jobData.topOrigin = context->topOrigin().data();
@@ -198,7 +198,7 @@
return;
}
- CONTAINER_RELEASE_LOG_IF_ALLOWED("unregisterRegistration: Unregistering service worker.");
+ CONTAINER_RELEASE_LOG("unregisterRegistration: Unregistering service worker.");
m_swConnection->scheduleUnregisterJobInServer(registrationIdentifier, contextIdentifier(), [promise = WTFMove(promise)](auto&& result) mutable {
promise.settle(WTFMove(result));
});
@@ -225,7 +225,7 @@
jobData.scopeURL = scopeURL;
jobData.scriptURL = scriptURL;
- CONTAINER_RELEASE_LOG_IF_ALLOWED("removeRegistration: Updating service worker. jobID=%" PRIu64, jobData.identifier().jobIdentifier.toUInt64());
+ CONTAINER_RELEASE_LOG("removeRegistration: Updating service worker. jobID=%" PRIu64, jobData.identifier().jobIdentifier.toUInt64());
scheduleJob(makeUnique<ServiceWorkerJob>(*this, WTFMove(promise), WTFMove(jobData)));
}
@@ -330,7 +330,7 @@
destroyJob(job);
});
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("jobFailedWithException: Job %" PRIu64 " failed with error %s", job.identifier().toUInt64(), exception.message().utf8().data());
+ CONTAINER_RELEASE_LOG_ERROR("jobFailedWithException: Job %" PRIu64 " failed with error %s", job.identifier().toUInt64(), exception.message().utf8().data());
auto promise = job.takePromise();
if (!promise)
@@ -355,10 +355,10 @@
ASSERT_WITH_MESSAGE(job.hasPromise() || job.data().type == ServiceWorkerJobType::Update, "Only soft updates have no promise");
if (job.data().type == ServiceWorkerJobType::Register)
- CONTAINER_RELEASE_LOG_IF_ALLOWED("jobResolvedWithRegistration: Registration job %" PRIu64 " succeeded", job.identifier().toUInt64());
+ CONTAINER_RELEASE_LOG("jobResolvedWithRegistration: Registration job %" PRIu64 " succeeded", job.identifier().toUInt64());
else {
ASSERT(job.data().type == ServiceWorkerJobType::Update);
- CONTAINER_RELEASE_LOG_IF_ALLOWED("jobResolvedWithRegistration: Update job %" PRIu64 " succeeded", job.identifier().toUInt64());
+ CONTAINER_RELEASE_LOG("jobResolvedWithRegistration: Update job %" PRIu64 " succeeded", job.identifier().toUInt64());
}
auto guard = WTF::makeScopeExit([this, &job] {
@@ -382,7 +382,7 @@
auto registration = ServiceWorkerRegistration::getOrCreate(*scriptExecutionContext(), *this, WTFMove(data));
- CONTAINER_RELEASE_LOG_IF_ALLOWED("jobResolvedWithRegistration: Resolving promise for job %" PRIu64 ". registrationID=%" PRIu64, jobIdentifier.toUInt64(), registration->identifier().toUInt64());
+ CONTAINER_RELEASE_LOG("jobResolvedWithRegistration: Resolving promise for job %" PRIu64 ". registrationID=%" PRIu64, jobIdentifier.toUInt64(), registration->identifier().toUInt64());
if (shouldNotifyWhenResolved == ShouldNotifyWhenResolved::Yes) {
m_ongoingSettledRegistrations.add(++m_lastOngoingSettledRegistrationIdentifier, registration->data().key);
@@ -427,7 +427,7 @@
destroyJob(job);
});
- CONTAINER_RELEASE_LOG_IF_ALLOWED("jobResolvedWithUnregistrationResult: Unregister job %" PRIu64 " finished. Success? %d", job.identifier().toUInt64(), unregistrationResult);
+ CONTAINER_RELEASE_LOG("jobResolvedWithUnregistrationResult: Unregister job %" PRIu64 " finished. Success? %d", job.identifier().toUInt64(), unregistrationResult);
auto* context = scriptExecutionContext();
if (!context) {
@@ -444,7 +444,7 @@
{
ASSERT(m_creationThread.ptr() == &Thread::current());
- CONTAINER_RELEASE_LOG_IF_ALLOWED("startScriptFetchForJob: Starting script fetch for job %" PRIu64, job.identifier().toUInt64());
+ CONTAINER_RELEASE_LOG("startScriptFetchForJob: Starting script fetch for job %" PRIu64, job.identifier().toUInt64());
auto* context = scriptExecutionContext();
if (!context) {
@@ -461,7 +461,7 @@
{
ASSERT(m_creationThread.ptr() == &Thread::current());
- CONTAINER_RELEASE_LOG_IF_ALLOWED("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
+ CONTAINER_RELEASE_LOG("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
ensureSWClientConnection().finishFetchingScriptInServer(ServiceWorkerFetchResult { job.data().identifier(), job.data().registrationKey(), script, certificateInfo, contentSecurityPolicy, referrerPolicy, { } });
}
@@ -471,7 +471,7 @@
ASSERT(m_creationThread.ptr() == &Thread::current());
ASSERT_WITH_MESSAGE(job.hasPromise() || job.data().type == ServiceWorkerJobType::Update, "Only soft updates have no promise");
- CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("jobFinishedLoadingScript: Failed to fetch script for job %" PRIu64 ", error: %s", job.identifier().toUInt64(), error.localizedDescription().utf8().data());
+ CONTAINER_RELEASE_LOG_ERROR("jobFinishedLoadingScript: Failed to fetch script for job %" PRIu64 ", error: %s", job.identifier().toUInt64(), error.localizedDescription().utf8().data());
if (auto promise = job.takePromise()) {
queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), exception = WTFMove(exception)]() mutable {
@@ -569,21 +569,6 @@
return iterator->value.job.get();
}
-bool ServiceWorkerContainer::isAlwaysOnLoggingAllowed() const
-{
- auto* context = scriptExecutionContext();
- if (!context)
- return false;
-
- if (is<Document>(*context)) {
- auto* page = downcast<Document>(*context).page();
- return page && page->sessionID().isAlwaysOnLoggingAllowed();
- }
-
- // FIXME: No logging inside service workers for now.
- return false;
-}
-
bool ServiceWorkerContainer::addEventListener(const AtomString& eventType, Ref<EventListener>&& eventListener, const AddEventListenerOptions& options)
{
// Setting the onmessage EventHandler attribute on the ServiceWorkerContainer should start the messages
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (278787 => 278788)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2021-06-11 23:13:05 UTC (rev 278788)
@@ -89,8 +89,6 @@
bool isStopped() const { return m_isStopped; };
- bool isAlwaysOnLoggingAllowed() const;
-
NavigatorBase* navigator() { return &m_navigator; }
private:
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (278787 => 278788)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2021-06-11 22:57:39 UTC (rev 278787)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2021-06-11 23:13:05 UTC (rev 278788)
@@ -39,8 +39,8 @@
#include "WorkerGlobalScope.h"
#include <wtf/IsoMallocInlines.h>
-#define REGISTRATION_RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(m_container->isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorkerRegistration::" fmt, this, ##__VA_ARGS__)
-#define REGISTRATION_RELEASE_LOG_ERROR_IF_ALLOWED(fmt, ...) RELEASE_LOG_ERROR_IF(m_container->isAlwaysOnLoggingAllowed(), ServiceWorker, "%p - ServiceWorkerRegistration::" fmt, this, ##__VA_ARGS__)
+#define REGISTRATION_RELEASE_LOG(fmt, ...) RELEASE_LOG(ServiceWorker, "%p - ServiceWorkerRegistration::" fmt, this, ##__VA_ARGS__)
+#define REGISTRATION_RELEASE_LOG_ERROR(fmt, ...) RELEASE_LOG_ERROR(ServiceWorker, "%p - ServiceWorkerRegistration::" fmt, this, ##__VA_ARGS__)
namespace WebCore {
@@ -71,7 +71,7 @@
if (m_registrationData.activeWorker)
m_activeWorker = ServiceWorker::getOrCreate(context, WTFMove(*m_registrationData.activeWorker));
- REGISTRATION_RELEASE_LOG_IF_ALLOWED("ServiceWorkerRegistration: ID %llu, installing=%llu, waiting=%llu, active=%llu", identifier().toUInt64(), m_installingWorker ? m_installingWorker->identifier().toUInt64() : 0, m_waitingWorker ? m_waitingWorker->identifier().toUInt64() : 0, m_activeWorker ? m_activeWorker->identifier().toUInt64() : 0);
+ REGISTRATION_RELEASE_LOG("ServiceWorkerRegistration: ID %llu, installing=%llu, waiting=%llu, active=%llu", identifier().toUInt64(), m_installingWorker ? m_installingWorker->identifier().toUInt64() : 0, m_waitingWorker ? m_waitingWorker->identifier().toUInt64() : 0, m_activeWorker ? m_activeWorker->identifier().toUInt64() : 0);
m_container->addRegistration(*this);
@@ -165,15 +165,15 @@
{
switch (state) {
case ServiceWorkerRegistrationState::Installing:
- REGISTRATION_RELEASE_LOG_IF_ALLOWED("updateStateFromServer: Setting registration %llu installing worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
+ REGISTRATION_RELEASE_LOG("updateStateFromServer: Setting registration %llu installing worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
m_installingWorker = WTFMove(serviceWorker);
break;
case ServiceWorkerRegistrationState::Waiting:
- REGISTRATION_RELEASE_LOG_IF_ALLOWED("updateStateFromServer: Setting registration %llu waiting worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
+ REGISTRATION_RELEASE_LOG("updateStateFromServer: Setting registration %llu waiting worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
m_waitingWorker = WTFMove(serviceWorker);
break;
case ServiceWorkerRegistrationState::Active:
- REGISTRATION_RELEASE_LOG_IF_ALLOWED("updateStateFromServer: Setting registration %llu active worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
+ REGISTRATION_RELEASE_LOG("updateStateFromServer: Setting registration %llu active worker to %llu", identifier().toUInt64(), serviceWorker ? serviceWorker->identifier().toUInt64() : 0);
m_activeWorker = WTFMove(serviceWorker);
break;
}
@@ -184,7 +184,7 @@
if (isContextStopped())
return;
- REGISTRATION_RELEASE_LOG_IF_ALLOWED("fireUpdateFoundEvent: Firing updatefound event for registration %llu", identifier().toUInt64());
+ REGISTRATION_RELEASE_LOG("fireUpdateFoundEvent: Firing updatefound event for registration %llu", identifier().toUInt64());
queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().updatefoundEvent, Event::CanBubble::No, Event::IsCancelable::No));
}