chore(server): introduce InputActionObserver on BrowserContext#40695
chore(server): introduce InputActionObserver on BrowserContext#40695dgozman wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Replace `Instrumentation.onBeforeInputAction` with a dedicated `InputActionObserver` registered on `BrowserContext`. The observer receives `(progress, target)` where target is `Page | ElementHandle`. `Tracing`, `Debugger`, and `Screencast` register themselves on the context and remove themselves on close/dispose.
Pass the optional bounding box as a third argument to `performOnBeforeInputAction`. Pointer actions in `dom.ts` already have the box from clickable-point computation; for non-pointer actions on an `ElementHandle`, `Screencast` computes the box itself when it needs one. This also lets `Screencast` stop being an `InstrumentationListener` (its only use of `onBeforeCall` was flipping the now-removed `annotate` flag) and inlines the small `_beforeNonPointerAction` helper at its 5 call sites.
Pass the action point as a fourth argument to `performOnBeforeInputAction(progress, target, point?, box?)`. Mouse, touchscreen, and pointer-action call sites supply it directly; `Screencast` and `Tracing` consume it from the argument instead of reading `metadata.point`. The trace's after-action event no longer carries a point (the input event still does, which is what trace viewer reads). `Recorder` now registers as an `InputActionObserver` and caches points by callId so the overlay can keep drawing the action-point dot.
Test results for "MCP"9 failed 7006 passed, 1058 skipped Merge workflow run. |
Test results for "tests 1"14 fatal errors, not part of any test 3 flaky41539 passed, 851 skipped, 112 did not run Merge workflow run. |
Summary
onBeforeInputActionoffInstrumentationand onto a newInputActionObserveronBrowserContext; observers receive(progress, target: Page | ElementHandle, point?, box?).Tracing,Debugger,Screencast, andRecorderregister themselves as observers;Screencastno longer needs to be anInstrumentationListener.annotate,box, andpointfromCallMetadata— they're now passed as observer arguments at the call site (withScreencastcomputing aboundingBoxitself when needed andRecordercaching points bycallId).