Preserve registered callbacks passed through state events

HA
2h ago
+327-9

Closes #4894.

Passing an uncalled handler to another event tried to compile it as a no-argument conditional event. A partially applied event declared in a page could reach the receiving handler as a plain browser object, so forwarding it to rx.call_script lost the callback.

Bind uncalled handlers as partial events. When a receiving state handler's parameter is annotated as an event callback, restore the browser's event object through the registration context. Ordinary payload dictionaries keep their existing semantics. Bound arguments are validated against the registered handler and keep their names when a subsequent trigger supplies the remaining arguments.

The new Chromium regression fails on main and exercises server-initiated forwarding, browser-initiated forwarding and partial application. A unit regression covers registry resolution, named binding, ordinary payloads and malformed callback references.

  • 727 event unit tests passed.
  • 4 Chromium call-script tests passed.
  • 5 focused cases passed on Python 3.11.
  • Pre-commit passed.