Skip to content

Commit 66c2aad

Browse files
committed
Remove dead CDP resize helper and preserve zero window origin
1 parent 785a321 commit 66c2aad

2 files changed

Lines changed: 5 additions & 33 deletions

File tree

server/cmd/api/api/display.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -493,34 +493,6 @@ func (s *ApiService) setViewportViaCDP(ctx context.Context, width, height int) e
493493
return nil
494494
}
495495

496-
func (s *ApiService) setMaximizedWindowViaCDP(ctx context.Context, width, height int) error {
497-
log := logger.FromContext(ctx)
498-
499-
upstreamURL := s.upstreamMgr.Current()
500-
if upstreamURL == "" {
501-
return fmt.Errorf("devtools upstream not available")
502-
}
503-
504-
cdpCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
505-
defer cancel()
506-
507-
client, err := cdpclient.Dial(cdpCtx, upstreamURL)
508-
if err != nil {
509-
return fmt.Errorf("failed to connect to devtools: %w", err)
510-
}
511-
defer client.Close()
512-
513-
if err := client.SetFirstPageWindowBoundsAndMaximize(cdpCtx, width, height); err != nil {
514-
return fmt.Errorf("CDP setWindowBounds: %w", err)
515-
}
516-
if err := s.verifyMaximizedChromiumWindow(ctx, width, height); err != nil {
517-
return err
518-
}
519-
520-
log.Info("chromium window resized and maximized via CDP", "width", width, "height", height)
521-
return nil
522-
}
523-
524496
func (s *ApiService) verifyCurrentCDP(ctx context.Context) error {
525497
upstreamURL := s.upstreamMgr.Current()
526498
if upstreamURL == "" {

server/lib/cdpclient/cdpclient.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ func (c *Client) SetFirstPageWindowBoundsAndMaximize(ctx context.Context, width,
193193
}
194194
if _, err := c.send(ctx, "Browser.setWindowBounds", map[string]any{
195195
"windowId": window.WindowID,
196-
"bounds": browserWindowBounds{
197-
Left: 0,
198-
Top: 0,
199-
Width: width,
200-
Height: height,
196+
"bounds": map[string]any{
197+
"left": 0,
198+
"top": 0,
199+
"width": width,
200+
"height": height,
201201
},
202202
}, ""); err != nil {
203203
return fmt.Errorf("Browser.setWindowBounds size: %w", err)

0 commit comments

Comments
 (0)