Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 50e5a0f85821c2e0ff2373edab9b7f8ce01d997e
https://github.com/WebKit/WebKit/commit/50e5a0f85821c2e0ff2373edab9b7f8ce01d997e
Author: Qianlang Chen <[email protected]>
Date: 2025-02-28 (Fri, 28 Feb 2025)
Changed paths:
M Source/WTF/wtf/PlatformEnableCocoa.h
M Source/WebCore/workers/WorkerOrWorkletThread.h
M Source/WebCore/workers/WorkerRunLoop.h
M Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp
M Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h
M Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp
M Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h
M Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
M Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h
M Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
M Source/WebKit/UIProcess/WebProcessProxy.h
M Source/WebKit/UIProcess/WebProcessProxy.messages.in
M Source/WebKit/WebProcess/Inspector/ServiceWorkerDebuggableProxy.cpp
M Source/WebKit/WebProcess/Inspector/ServiceWorkerDebuggableProxy.h
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in
Log Message:
-----------
Web Inspector: The new ServiceWorkerDebuggableProxy needs to adopt auto
inspection
rdar://145795990
https://bugs.webkit.org/show_bug.cgi?id=288776
Reviewed by Patrick Angle and Per Arne Vollan.
The work in [1] introduced the ServiceWorkerDebuggableProxy that
provides debugging support to service worker from the UI process.
This commit migrates the work done in [2] to support automatically
inspecting this new debuggable type instead.
- [1] https://github.com/WebKit/WebKit/pull/40437 (Add
ServiceWorkerDebuggableProxy)
- [2] https://github.com/WebKit/WebKit/pull/20316 (Enable auto-inspecting
ServiceWorkerDebuggable)
To summarize how automatic inspection generally works:
1. The web content marks its debuggable as inspectable.
2. The debuggable blocks its thread before starting code execution.
3. The auto-launched frontend, after initializing, notifies the backend.
4. The backend unblocks the debuggable to resume its code execution.
The ServiceWorkerDebuggableProxy lives in the UI process but controls
the service worker's thread. Notably, during step 3, the UI process is
also the one handling responses from the remote inspector, meaning the
UI process can't be blocked while waiting for the frontend. Instead, it
tells the underlying service worker to remain paused. The web process
then carries on with the normal procedure of waiting for the frontend's
signal.
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.messages.in:
* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::createServiceWorkerDebuggable):
* Source/WebKit/WebProcess/Inspector/ServiceWorkerDebuggableProxy.cpp:
(WebKit::ServiceWorkerDebuggableProxy::pauseWaitingForAutomaticInspection):
- In step 2, when we mark the debuggable as inspectable, it should
pause and prevent code execution. This is now done as an async
response to tell the service worker thread to remain paused from
the WaitForInspector start mode.
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
- To cooperate and finish step 2, handle the request to either pause
or unpause immediately.
* Source/WebKit/WebProcess/Inspector/ServiceWorkerDebuggableProxy.h:
* Source/WebKit/WebProcess/Inspector/ServiceWorkerDebuggableProxy.cpp:
(WebKit::ServiceWorkerDebuggableProxy::connect):
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in:
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::connectToInspector):
* Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h:
* Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp:
(WebCore::ServiceWorkerInspectorProxy::connectToWorker):
- During step 3, when connecting the backend and frontend, pass in
the values indicating auto inspection or pausing, and listen to the
frontendInitialized event from the web process.
* Source/WebCore/workers/WorkerOrWorkletThread.h:
* Source/WebCore/workers/WorkerRunLoop.h:
- Export these methods to be visible to WebKit.
* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h:
* Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp:
(WebCore::ServiceWorkerDebuggable::connect):
* Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h:
* Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
(WebCore::ServiceWorkerThreadProxy::threadStartedRunningDebuggerTasks): Deleted.
- As part of the migration, remove the auto-inspection support from
the old ServiceWorkerDebuggable.
Canonical link: https://commits.webkit.org/291414@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes