Skip to content

fix(cdp): Hermes-driver compatibility (getTargets, getBoxModel ints, insertText) - #595

Closed
fepfitra wants to merge 1 commit into
h4ckf0r0day:mainfrom
fepfitra:fix/cdp-hermes-quirks
Closed

fix(cdp): Hermes-driver compatibility (getTargets, getBoxModel ints, insertText)#595
fepfitra wants to merge 1 commit into
h4ckf0r0day:mainfrom
fepfitra:fix/cdp-hermes-quirks

Conversation

@fepfitra

@fepfitra fepfitra commented Aug 9, 2026

Copy link
Copy Markdown

Fixes three CDP quirks that break Hermes Agent (and other puppeteer/playwright-style clients) driving obscura:

  1. Target.getTargets returns empty on fresh browser connections (Target.getTargets returns empty for new connections — pages not globally visible (CDP spec violation) #543, serve mode: Target.getTargets empty on fresh browser connection — puppeteer.connect sees no pages #570). A browser-level client that connects and immediately calls Target.getTargets saw [] because the pages registry was only populated by session-scoped events. Now NewConnection creates a page + session mirroring the interception path, so targets are globally visible per the CDP spec.

  2. DOM.getBoxModel emits float coordinates where the spec requires integers. Clients deserializing coordinates as i64 (Hermes: "invalid type: floating point 32.0, expected i64") fail. All quad coords + width/height now rounded to integers.

  3. Input.insertText not implemented ("Unknown Input method: insertText"). Implemented via the existing prototype-setter JS path (__obscura_setFieldValue), caret-aware with selection replacement, and dispatches a trusted input event so React/Vue controlled inputs register typed text.

All three verified live driving the patched build from Hermes: fresh-connection getTargets lists targets, getBoxModel returns integer coords, insertText types into a login form and submits.

Tests added: get_box_model_returns_integer_coordinates, insert_text_types_into_focused_input, fresh_connection_sees_page_targets_in_get_targets. Full workspace: 81 tests pass, release build clean.

…insertText)

- Target.getTargets now lists page targets on fresh browser connections
  (issue h4ckf0r0day#543): NewConnection creates a page + session mirroring the
  interception path, so puppeteer/playwright-style clients see pages
  before any createTarget call.
- DOM.getBoxModel rounds all quad and width/height coordinates to
  integers per the CDP spec; clients deserializing as i64 (Hermes)
  no longer fail with "floating point, expected i64".
- Input.insertText implemented via the existing prototype-setter JS
  path (trusted input event), so React/Vue controlled inputs register
  typed text.

Tests: get_box_model_returns_integer_coordinates,
insert_text_types_into_focused_input,
fresh_connection_sees_page_targets_in_get_targets. 81 tests pass.
@fepfitra

Copy link
Copy Markdown
Author

First of a 3-PR stack (595 → 597 → 634). All mergeable/clean. Fixes Hermes browser integration (getTargets, getBoxModel ints, insertText).

@fepfitra

Copy link
Copy Markdown
Author

Superseded by #634 — consolidated the 3-PR stack into one PR (single reviewable diff, no merge ordering).

@fepfitra fepfitra closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant