Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/server-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
cache-dependency-path: server/go.sum

- name: Run CDP telemetry browser regressions
run: go test -race ./lib/cdpmonitor -run '^(TestNetworkCapture|TestTelemetryConnection|TestProxyErrorE2E|TestNewClientAutoAttachAfterMonitoredSharedWorkerEnds)' -count=1 -v
run: go test -race ./lib/cdpmonitor -run '^(TestNetworkCapture|TestTelemetryConnection|TestProxyErrorE2E)' -count=1 -v
working-directory: server
env:
KERNEL_CDPMONITOR_CHROME_E2E: "1"
Expand Down
13 changes: 0 additions & 13 deletions server/lib/browsersurface/sessions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ func TestWorkerDiscoveryIsOptIn(t *testing.T) {
protocol.emitTarget("Target.attachedToTarget", map[string]any{
"sessionId": "worker-session", "targetInfo": targets[0],
})
protocol.emitTarget("Target.attachedToTarget", map[string]any{
"sessionId": "shared-worker-session", "targetInfo": targets[1],
})
for _, target := range targets {
// Repeated discovery must not create another session.
protocol.emitTarget("Target.targetCreated", map[string]any{"targetInfo": target})
Expand Down Expand Up @@ -70,14 +67,6 @@ func TestWorkerDiscoveryIsOptIn(t *testing.T) {
}, time.Second, time.Millisecond, "nested dedicated-worker discovery must be enabled")
}
protocol.mu.Lock()
browserAutoAttach := protocol.autoAttachCalls[""]
protocol.mu.Unlock()
if enabled {
require.Equal(t, 1, browserAutoAttach, "shared workers attach through browser-level auto-attach")
} else {
require.Zero(t, browserAutoAttach)
}
protocol.mu.Lock()
calls := maps.Clone(protocol.attachCalls)
types := slices.Clone(protocol.discoveredTypes)
pageCalls := maps.Clone(protocol.pageEnableCalls)
Expand All @@ -86,8 +75,6 @@ func TestWorkerDiscoveryIsOptIn(t *testing.T) {
if enabled {
if target.Type == "worker" {
require.Zero(t, calls[target.TargetID], "dedicated workers attach only through their parent")
} else if target.Type == "shared_worker" {
require.Zero(t, calls[target.TargetID], "shared workers attach only through auto-attach")
} else {
require.Equal(t, 1, calls[target.TargetID])
}
Expand Down
3 changes: 1 addition & 2 deletions server/lib/browsersurface/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ func (t *Tracker) attachTarget(target targetInfo) error {
func (t *Tracker) trackNonPageTarget(target targetInfo) {
// Dedicated workers are attached through their parent's Target domain;
// browser-wide enumeration/discovery does not reliably expose them.
// Shared workers are attached by browser-level auto-attach; see Start.
if target.Type == "worker" || target.Type == "shared_worker" {
if target.Type == "worker" {
return
}
t.stateMu.Lock()
Expand Down
13 changes: 0 additions & 13 deletions server/lib/browsersurface/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ func (t *Tracker) Start(ctx context.Context) error {
t.startErr = fmt.Errorf("start browser surface discovery: %w", err)
return t.startErr
}
// Chrome detaches auto-attached shared worker sessions when the worker
// ends. An attachToTarget session would instead keep the ended worker's
// DevTools host alive, and another client's browser-level auto-attach
// crashes stock Chromium on that host.
if t.tracksTarget("shared_worker") {
if _, err := t.protocol.Send(ctx, "Target.setAutoAttach", map[string]any{
"autoAttach": true, "flatten": true, "waitForDebuggerOnStart": false,
"filter": []map[string]any{{"type": "shared_worker"}},
}, ""); err != nil {
t.startErr = fmt.Errorf("start shared worker auto-attach: %w", err)
return t.startErr
}
}
raw, err := t.protocol.Send(ctx, "Target.getTargets", nil, "")
if err != nil {
t.startErr = fmt.Errorf("list browser tabs: %w", err)
Expand Down
6 changes: 2 additions & 4 deletions server/lib/cdpmonitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ CDP session, or tracker state is shared with WebMCP. Telemetry adds worker and
background-page targets with `WithAdditionalTargets` and uses `WithoutLocations`: it receives attachment events without waiting for window
lookup or frame-tree initialization, and enables its own capture domains.

The tracker explicitly discovers and attaches pages, OOPIFs, service workers, and
extension background pages. Shared workers attach through a browser-level
`Target.setAutoAttach` filtered to `shared_worker`, so Chrome detaches their sessions
when the worker ends. Dedicated workers require parent-session `Target.setAutoAttach`;
The tracker explicitly discovers and attaches pages, OOPIFs, shared workers, and
service workers (and extension background pages). Dedicated workers require parent-session `Target.setAutoAttach`;
that subscription is also installed on worker sessions to discover nested workers.
Only `worker` targets match this auto-attach filter, avoiding duplicate attachment
of explicitly discovered OOPIFs. WebMCP's default tracker still tracks page/frame
Expand Down
101 changes: 0 additions & 101 deletions server/lib/cdpmonitor/shared_worker_attach_chrome_e2e_test.go

This file was deleted.

Loading