Skip to content

fix(cdp): emit runtime console and exception events - #719

Open
lisa0314 wants to merge 1 commit into
h4ckf0r0day:mainfrom
lisa0314:fix/677-runtime-events
Open

fix(cdp): emit runtime console and exception events#719
lisa0314 wants to merge 1 commit into
h4ckf0r0day:mainfrom
lisa0314:fix/677-runtime-events

Conversation

@lisa0314

Copy link
Copy Markdown
Contributor

What changed

  • Forward page console calls as Runtime.consoleAPICalled events while preserving argument boundaries as CDP RemoteObject values.
  • Emit Runtime.exceptionThrown for uncaught classic-script compilation and execution errors with URL, location, stack trace, context, and timestamp details.
  • Track Runtime.enable per attached session, implement Runtime.disable, clean up detached subscriptions, bound the event queue, and skip console object retention when no Runtime subscriber exists.

Fixes #677

Validation

  • cargo nextest run --release --features render -p obscura-cdp --test runtime_console_events: 2 passed.
  • cargo nextest run --release --no-default-features -p obscura-cdp --test runtime_console_events: 2 passed.
  • cargo nextest run --release --features render -p obscura-cdp: 158 passed, 3 skipped.
  • cargo nextest run --release --features render -p obscura-js -p obscura-browser: 470 passed.
  • Full release/render workspace nextest: 1486 of 1487 passed, with 4 skipped. The one public-host resolver test passed when rerun alone.
  • Release CLI builds passed with --features render and with --no-default-features.
  • The raw WebSocket reproduction received 2 console events, 1 exception event, and 0 Log.entryAdded events while retaining the expected page marker.
  • Obstacle course: 32 of 33 passed. observer-intersection expected io:50 and received an empty result; all other stages passed.
  • git diff --check passed.

Rendering

Not applicable. This does not change layout, paint, screenshots, screencasting, or PDF output.

Performance

Console RemoteObject serialization and object retention only run while at least one session has enabled the Runtime domain. The native page queue is capped at 1024 events with constant-time eviction.

Checklist

  • The change is focused and does not remove existing behavior without justification.
  • Tests cover the failure or feature.
  • Existing tests pass, including render and no-render configurations when affected.
  • I checked for CPU, latency, and memory regressions.
  • Public API or user-facing behavior changes are documented.

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.

CDP: Runtime.consoleAPICalled and Runtime.exceptionThrown are never sent, so console output and page errors remain invisible to CDP clients

1 participant