Skip to content

Commit a85f489

Browse files
committed
Web Inspector: Automatically connect Web Inspector to ServiceWorker
https://bugs.webkit.org/show_bug.cgi?id=264576 rdar://114997939 Reviewed by BJ Burg. (This work was done in collaboration with Razvan and was based on his draft at WebKit@377f3e1.) This commit enables automatically inspecting and pausing the ServiceWorkerDebuggable. The idea is similar to the same functionalities with the JSContext/JSGlobalObjectDebuggable. The general flow is: 1. When the debuggable is first created, we optionally mark it as inspectable. 2. As soon as the debuggable is marked inspectable, its main thread (the thread that it was created on) gets blocked. 3. When the auto-launched Web Inspector frontend finishes initializing, it notifies the backend. - It's important for the debuggable to wait for this signal because a genuine auto-inspection must appear attached to the debuggable before it begins execution, respecting any breakpoints set early on in its script (where auto-pausing is basically a breakpoint before line 1). 4. The backend unpauses the blocked debuggable. If auto-pausing was requested, tell the debugger agent to pause. The service worker begins executing script unless its worker thread was specified to start in the WorkerThreadStartMode::WaitForInspector. During that waiting period, the worker thread can perform tasks sent into its debugging run loop, until it's signaled to stop waiting and continue to execute the script like normal. This commit makes use of that interface to make the service worker pause (when justified, i.e. developerExtrasEnabled) before running the above flow resembling auto-inspecting a JSContext. * Source/WebCore/workers/service/context/ServiceWorkerThread.cpp: (WebCore::threadStartModeFromSettings): (WebCore::ServiceWorkerThread::ServiceWorkerThread): - When there is potentially a remote inspector that would like to auto-inspect, make it so that the thread waits on start before executing its script. * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h: * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): (WebCore::ServiceWorkerThreadProxy::threadStartedRunningDebuggerTasks): - Setting inspectability is step #1 in the above flow. - In step #2, calling `debuggable->setInspectable(true)` might block already, but we don't want that until the worker thread is setup and have the run loop be in debug mode, so we do that in a callback instead. - In step #4, when connection to the inspector completes or fails, the setInspectable call only returns then, so we unblock the worker thread to resume code execution. * Source/WebCore/inspector/agents/worker/WorkerDebuggerAgent.h: * Source/WebCore/inspector/WorkerInspectorController.h: * Source/WebCore/inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::frontendInitialized): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::ensureDebuggerAgent): * Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp: (WebCore::ServiceWorkerDebuggable::connect): * Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h: * Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp: (WebCore::ServiceWorkerInspectorProxy::connectToWorker): - Mimic the logic for auto-inspecting a JSContext/JSGlobalObjectDebuggable. * Source/JavaScriptCore/inspector/protocol/Inspector.json: - Step #3 in the above flow, notify the backend when frontend completes setting up. * Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h: - Allow service workers to be auto-inspected. (This is checked at https://github.com/rcaliman-apple/WebKit/blob/eng/Web-Inspector-Automatically-connect-Web-Inspector-to-ServiceWorker/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp#L95) * Source/WTF/wtf/PlatformEnableCocoa.h: - Add feature flag just in case. Canonical link: https://commits.webkit.org/291167@main
1 parent 9c6dd75 commit a85f489

12 files changed

+145
-15
lines changed

Source/JavaScriptCore/inspector/protocol/Inspector.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "Inspector",
3-
"debuggableTypes": ["itml", "javascript", "page", "web-page"],
4-
"targetTypes": ["itml", "javascript", "page"],
3+
"debuggableTypes": ["itml", "javascript", "page", "service-worker", "web-page"],
4+
"targetTypes": ["itml", "javascript", "page", "service-worker"],
55
"commands": [
66
{
77
"name": "enable",

Source/WTF/wtf/PlatformEnableCocoa.h

+4
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,10 @@
788788
#define ENABLE_REMOTE_INSPECTOR 1
789789
#endif
790790

791+
#if !defined(ENABLE_REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
792+
#define ENABLE_REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION 1
793+
#endif
794+
791795
#if !defined(ENABLE_REMOTE_LAYER_TREE_ON_MAC_BY_DEFAULT) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000
792796
#define ENABLE_REMOTE_LAYER_TREE_ON_MAC_BY_DEFAULT 1
793797
#endif

Source/WebCore/inspector/WorkerInspectorController.cpp

+40-5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include "WorkerTimelineAgent.h"
5151
#include "WorkerToPageFrontendChannel.h"
5252
#include "WorkerWorkerAgent.h"
53+
#include <JavaScriptCore/InspectorAgent.h>
5354
#include <JavaScriptCore/InspectorAgentBase.h>
5455
#include <JavaScriptCore/InspectorBackendDispatcher.h>
5556
#include <JavaScriptCore/InspectorFrontendChannel.h>
@@ -101,11 +102,31 @@ void WorkerInspectorController::workerTerminating()
101102
m_debugger = nullptr;
102103
}
103104

104-
void WorkerInspectorController::connectFrontend()
105+
void WorkerInspectorController::frontendInitialized()
106+
{
107+
#if ENABLE(REMOTE_INSPECTOR) && ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
108+
if (m_pauseAfterInitialization) {
109+
m_pauseAfterInitialization = false;
110+
111+
ensureDebuggerAgent().enable();
112+
ensureDebuggerAgent().pause();
113+
}
114+
115+
if (m_isAutomaticInspection && m_frontendInitializedCallback)
116+
m_frontendInitializedCallback();
117+
m_frontendInitializedCallback = { };
118+
#endif
119+
}
120+
121+
void WorkerInspectorController::connectFrontend(bool isAutomaticInspection, bool immediatelyPause, Function<void()>&& frontendInitializedCallback)
105122
{
106123
ASSERT(!m_frontendRouter->hasFrontends());
107124
ASSERT(!m_forwardingChannel);
108125

126+
m_isAutomaticInspection = isAutomaticInspection;
127+
m_pauseAfterInitialization = immediatelyPause;
128+
m_frontendInitializedCallback = WTFMove(frontendInitializedCallback);
129+
109130
createLazyAgents();
110131

111132
callOnMainThread([] {
@@ -124,6 +145,10 @@ void WorkerInspectorController::connectFrontend()
124145

125146
void WorkerInspectorController::disconnectFrontend(Inspector::DisconnectReason reason)
126147
{
148+
m_isAutomaticInspection = false;
149+
m_pauseAfterInitialization = false;
150+
m_frontendInitializedCallback = { };
151+
127152
if (!m_frontendRouter->hasFrontends())
128153
return;
129154

@@ -203,17 +228,16 @@ void WorkerInspectorController::createLazyAgents()
203228
m_agents.append(makeUnique<WorkerRuntimeAgent>(workerContext));
204229

205230
if (is<ServiceWorkerGlobalScope>(m_globalScope)) {
231+
m_agents.append(makeUnique<InspectorAgent>(workerContext));
206232
m_agents.append(makeUnique<ServiceWorkerAgent>(workerContext));
207233
m_agents.append(makeUnique<WorkerNetworkAgent>(workerContext));
208234
}
209235

210236
m_agents.append(makeUnique<WebHeapAgent>(workerContext));
211237

212-
auto debuggerAgent = makeUnique<WorkerDebuggerAgent>(workerContext);
213-
auto debuggerAgentPtr = debuggerAgent.get();
214-
m_agents.append(WTFMove(debuggerAgent));
238+
ensureDebuggerAgent();
239+
m_agents.append(makeUnique<WorkerDOMDebuggerAgent>(workerContext, m_debuggerAgent.get()));
215240

216-
m_agents.append(makeUnique<WorkerDOMDebuggerAgent>(workerContext, debuggerAgentPtr));
217241
m_agents.append(makeUnique<WorkerAuditAgent>(workerContext));
218242
m_agents.append(makeUnique<WorkerCanvasAgent>(workerContext));
219243
m_agents.append(makeUnique<WorkerTimelineAgent>(workerContext));
@@ -227,6 +251,17 @@ void WorkerInspectorController::createLazyAgents()
227251
commandLineAPIHost->init(m_instrumentingAgents.copyRef());
228252
}
229253

254+
WorkerDebuggerAgent& WorkerInspectorController::ensureDebuggerAgent()
255+
{
256+
if (!m_debuggerAgent) {
257+
auto workerContext = workerAgentContext();
258+
auto debuggerAgent = makeUnique<WorkerDebuggerAgent>(workerContext);
259+
m_debuggerAgent = debuggerAgent.get();
260+
m_agents.append(WTFMove(debuggerAgent));
261+
}
262+
return *m_debuggerAgent;
263+
}
264+
230265
InspectorFunctionCallHandler WorkerInspectorController::functionCallHandler() const
231266
{
232267
return WebCore::functionCallHandlerFromAnyThread;

Source/WebCore/inspector/WorkerInspectorController.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#pragma once
2727

28+
#include "WorkerDebuggerAgent.h"
2829
#include "WorkerOrWorkletGlobalScope.h"
2930
#include <JavaScriptCore/InspectorAgentRegistry.h>
3031
#include <JavaScriptCore/InspectorEnvironment.h>
@@ -54,7 +55,7 @@ class WorkerInspectorController final : public Inspector::InspectorEnvironment {
5455

5556
void workerTerminating();
5657

57-
void connectFrontend();
58+
void connectFrontend(bool isAutomaticInspection = false, bool immediatelyPause = false, Function<void()>&& frontendInitializedCallback = { });
5859
void disconnectFrontend(Inspector::DisconnectReason);
5960

6061
void dispatchMessageFromFrontend(const String&);
@@ -64,7 +65,7 @@ class WorkerInspectorController final : public Inspector::InspectorEnvironment {
6465
bool canAccessInspectedScriptState(JSC::JSGlobalObject*) const override { return true; }
6566
Inspector::InspectorFunctionCallHandler functionCallHandler() const override;
6667
Inspector::InspectorEvaluateHandler evaluateHandler() const override;
67-
void frontendInitialized() override { }
68+
void frontendInitialized() final;
6869
WTF::Stopwatch& executionStopwatch() const override;
6970
JSC::Debugger* debugger() override;
7071
JSC::VM& vm() override;
@@ -74,6 +75,7 @@ class WorkerInspectorController final : public Inspector::InspectorEnvironment {
7475

7576
WorkerAgentContext workerAgentContext();
7677
void createLazyAgents();
78+
WorkerDebuggerAgent& ensureDebuggerAgent();
7779

7880
void updateServiceWorkerPageFrontendCount();
7981

@@ -84,9 +86,13 @@ class WorkerInspectorController final : public Inspector::InspectorEnvironment {
8486
Ref<WTF::Stopwatch> m_executionStopwatch;
8587
std::unique_ptr<WorkerDebugger> m_debugger;
8688
Inspector::AgentRegistry m_agents;
89+
CheckedPtr<WorkerDebuggerAgent> m_debuggerAgent;
8790
WeakRef<WorkerOrWorkletGlobalScope> m_globalScope;
8891
std::unique_ptr<Inspector::FrontendChannel> m_forwardingChannel;
8992
bool m_didCreateLazyAgents { false };
93+
bool m_isAutomaticInspection { false };
94+
bool m_pauseAfterInitialization { false };
95+
Function<void()> m_frontendInitializedCallback;
9096
};
9197

9298
} // namespace WebCore

Source/WebCore/inspector/agents/worker/WorkerDebuggerAgent.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@
2626
#pragma once
2727

2828
#include "WebDebuggerAgent.h"
29+
#include <wtf/CheckedRef.h>
2930
#include <wtf/TZoneMalloc.h>
3031

3132
namespace WebCore {
3233

3334
class WorkerOrWorkletGlobalScope;
3435

35-
class WorkerDebuggerAgent final : public WebDebuggerAgent {
36+
class WorkerDebuggerAgent final : public WebDebuggerAgent, public WTF::CanMakeThreadSafeCheckedPtr<WorkerDebuggerAgent> {
3637
WTF_MAKE_NONCOPYABLE(WorkerDebuggerAgent);
3738
WTF_MAKE_TZONE_ALLOCATED(WorkerDebuggerAgent);
39+
WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(WorkerDebuggerAgent);
3840
public:
3941
WorkerDebuggerAgent(WorkerAgentContext&);
4042
~WorkerDebuggerAgent();

Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "ServiceWorkerInspectorProxy.h"
3232
#include "ServiceWorkerThreadProxy.h"
33+
#include "WorkerRunLoop.h"
34+
#include <JavaScriptCore/RemoteInspector.h>
3335
#include <wtf/TZoneMallocInlines.h>
3436

3537
namespace WebCore {
@@ -49,10 +51,17 @@ ServiceWorkerDebuggable::ServiceWorkerDebuggable(ServiceWorkerThreadProxy& servi
4951
{
5052
}
5153

52-
void ServiceWorkerDebuggable::connect(FrontendChannel& channel, bool, bool)
54+
void ServiceWorkerDebuggable::connect(FrontendChannel& channel, bool isAutomaticInspection, bool immediatelyPause)
5355
{
54-
if (RefPtr serviceWorkerThreadProxy = m_serviceWorkerThreadProxy.get())
56+
if (RefPtr serviceWorkerThreadProxy = m_serviceWorkerThreadProxy.get()) {
57+
#if ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
58+
serviceWorkerThreadProxy->inspectorProxy().connectToWorker(channel, *this, isAutomaticInspection, immediatelyPause);
59+
#else
60+
UNUSED_PARAM(isAutomaticInspection);
61+
UNUSED_PARAM(immediatelyPause);
5562
serviceWorkerThreadProxy->inspectorProxy().connectToWorker(channel);
63+
#endif
64+
}
5665
}
5766

5867
void ServiceWorkerDebuggable::disconnect(FrontendChannel& channel)

Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class ServiceWorkerDebuggable final : public Inspector::RemoteInspectionTarget {
5353
void disconnect(Inspector::FrontendChannel&) final;
5454
void dispatchMessageFromRemote(String&& message) final;
5555

56+
bool automaticInspectionAllowed() const final { return true; }
57+
5658
private:
5759
ServiceWorkerDebuggable(ServiceWorkerThreadProxy&, const ServiceWorkerContextData&);
5860

Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828

2929
#include "SWContextManager.h"
3030
#include "ScriptExecutionContext.h"
31+
#include "ServiceWorkerDebuggable.h"
3132
#include "ServiceWorkerGlobalScope.h"
3233
#include "ServiceWorkerThreadProxy.h"
3334
#include "WorkerInspectorController.h"
3435
#include "WorkerRunLoop.h"
3536
#include <JavaScriptCore/InspectorAgentBase.h>
3637
#include <JavaScriptCore/InspectorFrontendChannel.h>
3738
#include <wtf/TZoneMallocInlines.h>
39+
#include <wtf/ThreadSafeWeakPtr.h>
3840

3941
namespace WebCore {
4042

@@ -70,6 +72,28 @@ void ServiceWorkerInspectorProxy::connectToWorker(FrontendChannel& channel)
7072
});
7173
}
7274

75+
#if ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
76+
77+
void ServiceWorkerInspectorProxy::connectToWorker(FrontendChannel& channel, ServiceWorkerDebuggable& debuggable, bool isAutomaticConnection, bool immediatelyPause)
78+
{
79+
m_channel = &channel;
80+
81+
RefPtr serviceWorkerThreadProxy = m_serviceWorkerThreadProxy.get();
82+
SWContextManager::singleton().setAsInspected(serviceWorkerThreadProxy->identifier(), true);
83+
84+
ThreadSafeWeakPtr weakDebuggable = ThreadSafeWeakPtr { debuggable };
85+
serviceWorkerThreadProxy->thread().runLoop().postDebuggerTask(
86+
[weakDebuggable, isAutomaticConnection, immediatelyPause](ScriptExecutionContext& context) {
87+
Function<void()> handleFrontendInitialized = [weakDebuggable] {
88+
if (RefPtr debuggable = weakDebuggable.get())
89+
debuggable->unpauseForInitializedInspector();
90+
};
91+
downcast<WorkerGlobalScope>(context).inspectorController().connectFrontend(isAutomaticConnection, immediatelyPause, WTFMove(handleFrontendInitialized));
92+
});
93+
}
94+
95+
#endif
96+
7397
void ServiceWorkerInspectorProxy::disconnectFromWorker(FrontendChannel& channel)
7498
{
7599
ASSERT_UNUSED(channel, &channel == m_channel);

Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#pragma once
2727

28+
#include "ServiceWorkerDebuggable.h"
2829
#include <wtf/Forward.h>
2930
#include <wtf/Noncopyable.h>
3031
#include <wtf/TZoneMalloc.h>
@@ -51,6 +52,9 @@ class ServiceWorkerInspectorProxy {
5152
void serviceWorkerTerminated();
5253

5354
WEBCORE_EXPORT void connectToWorker(Inspector::FrontendChannel&);
55+
#if ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
56+
WEBCORE_EXPORT void connectToWorker(Inspector::FrontendChannel&, ServiceWorkerDebuggable&, bool isAutomaticConnection = false, bool immediatelyPause = false);
57+
#endif
5458
WEBCORE_EXPORT void disconnectFromWorker(Inspector::FrontendChannel&);
5559
WEBCORE_EXPORT void sendMessageToWorker(String&&);
5660
void sendMessageFromWorkerToFrontend(String&&);

Source/WebCore/workers/service/context/ServiceWorkerThread.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,19 @@ static WorkerParameters generateWorkerParameters(const ServiceWorkerContextData&
117117
};
118118
}
119119

120+
static WorkerThreadStartMode threadStartModeFromSettings()
121+
{
122+
#if ENABLE(REMOTE_INSPECTOR) && ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
123+
// FIXME: Find a reasonable heuristic for when the service worker definitely won't be
124+
// automatically inspected, in which case there's no need to force this start mode.
125+
return WorkerThreadStartMode::WaitForInspector;
126+
#else
127+
return WorkerThreadStartMode::Normal;
128+
#endif
129+
}
130+
120131
ServiceWorkerThread::ServiceWorkerThread(ServiceWorkerContextData&& contextData, ServiceWorkerData&& workerData, String&& userAgent, WorkerThreadMode workerThreadMode, const Settings::Values& settingsValues, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy, WorkerBadgeProxy& badgeProxy, IDBClient::IDBConnectionProxy* idbConnectionProxy, SocketProvider* socketProvider, std::unique_ptr<NotificationClient>&& notificationClient, PAL::SessionID sessionID, std::optional<uint64_t> noiseInjectionHashSalt, OptionSet<AdvancedPrivacyProtections> advancedPrivacyProtections)
121-
: WorkerThread(generateWorkerParameters(contextData, WTFMove(userAgent), workerThreadMode, settingsValues, sessionID, advancedPrivacyProtections, noiseInjectionHashSalt), contextData.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), badgeProxy, WorkerThreadStartMode::Normal, contextData.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())
132+
: WorkerThread(generateWorkerParameters(contextData, WTFMove(userAgent), workerThreadMode, settingsValues, sessionID, advancedPrivacyProtections, noiseInjectionHashSalt), contextData.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), badgeProxy, threadStartModeFromSettings(), contextData.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())
122133
, m_serviceWorkerIdentifier(contextData.serviceWorkerIdentifier)
123134
, m_jobDataIdentifier(contextData.jobDataIdentifier)
124135
, m_contextData(crossThreadCopy(WTFMove(contextData)))

Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp

+27-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,19 @@ ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(Ref<Page>&& page, ServiceWork
8585
allServiceWorkerThreadProxies().add(*this);
8686

8787
#if ENABLE(REMOTE_INSPECTOR)
88-
m_remoteDebuggable->setInspectable(m_page->inspectable());
8988
m_remoteDebuggable->init();
90-
#endif
89+
90+
#if ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
91+
thread().runLoop().postDebuggerTask([this, protectedThis = Ref { *this }](ScriptExecutionContext&) {
92+
callOnMainThread([this, protectedThis] {
93+
threadStartedRunningDebuggerTasks();
94+
});
95+
});
96+
#else
97+
m_remoteDebuggable->setInspectable(m_page->inspectable());
98+
#endif // not ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
99+
100+
#endif // not ENABLE(REMOTE_INSPECTOR)
91101
}
92102

93103
ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy()
@@ -101,6 +111,21 @@ ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy()
101111
m_serviceWorkerThread->clearProxies();
102112
}
103113

114+
#if ENABLE(REMOTE_INSPECTOR) && ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
115+
116+
void ServiceWorkerThreadProxy::threadStartedRunningDebuggerTasks()
117+
{
118+
m_remoteDebuggable->setInspectable(m_page->inspectable());
119+
120+
// In case the worker is paused running debugger tasks, ensure we break out of
121+
// the pause since this will be the last debugger task we send to the worker.
122+
thread().runLoop().postDebuggerTask([this, protectedThis = Ref { *this }](ScriptExecutionContext&) {
123+
thread().stopRunningDebuggerTasks();
124+
});
125+
}
126+
127+
#endif
128+
104129
void ServiceWorkerThreadProxy::setLastNavigationWasAppInitiated(bool wasAppInitiated)
105130
{
106131
if (m_document->loader())

Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h

+8
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ class ServiceWorkerThreadProxy final : public ThreadSafeRefCountedAndCanMakeThre
100100

101101
WEBCORE_EXPORT void setInspectable(bool);
102102

103+
#if ENABLE(REMOTE_INSPECTOR) && ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
104+
ServiceWorkerDebuggable& remoteDebuggable() { return m_remoteDebuggable; }
105+
#endif
106+
103107
uint32_t checkedPtrCount() const { return CanMakeThreadSafeCheckedPtr<ServiceWorkerThreadProxy>::checkedPtrCount(); }
104108
uint32_t checkedPtrCountWithoutThreadCheck() const { return CanMakeThreadSafeCheckedPtr<ServiceWorkerThreadProxy>::checkedPtrCountWithoutThreadCheck(); }
105109
void incrementCheckedPtrCount() const { CanMakeThreadSafeCheckedPtr<ServiceWorkerThreadProxy>::incrementCheckedPtrCount(); }
@@ -111,6 +115,10 @@ class ServiceWorkerThreadProxy final : public ThreadSafeRefCountedAndCanMakeThre
111115
WEBCORE_EXPORT static void networkStateChanged(bool isOnLine);
112116
bool postTaskForModeToWorkerOrWorkletGlobalScope(ScriptExecutionContext::Task&&, const String& mode);
113117

118+
#if ENABLE(REMOTE_INSPECTOR) && ENABLE(REMOTE_INSPECTOR_SERVICE_WORKER_AUTO_INSPECTION)
119+
void threadStartedRunningDebuggerTasks();
120+
#endif
121+
114122
// WorkerLoaderProxy
115123
void postTaskToLoader(ScriptExecutionContext::Task&&) final;
116124
ScriptExecutionContextIdentifier loaderContextIdentifier() const final;

0 commit comments

Comments
 (0)