fix(cdp): Hermes-driver compatibility (getTargets, getBoxModel ints, insertText) - #595
Closed
fepfitra wants to merge 1 commit into
Closed
fix(cdp): Hermes-driver compatibility (getTargets, getBoxModel ints, insertText)#595fepfitra wants to merge 1 commit into
fepfitra wants to merge 1 commit into
Conversation
…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.
Author
|
First of a 3-PR stack (595 → 597 → 634). All mergeable/clean. Fixes Hermes browser integration (getTargets, getBoxModel ints, insertText). |
Author
|
Superseded by #634 — consolidated the 3-PR stack into one PR (single reviewable diff, no merge ordering). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three CDP quirks that break Hermes Agent (and other puppeteer/playwright-style clients) driving obscura:
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. NowNewConnectioncreates a page + session mirroring the interception path, so targets are globally visible per the CDP spec.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.
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 trustedinputevent 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.