fix(events): preserve listener mutations during dispatch

Track the exact registration represented by each dispatch snapshot and
refresh active handlers before invoking them. Removing and re-adding the
same callback no longer revives an entry from the current snapshot, while
handler replacements use their current value and callback contexts.

Share invocation preparation across simple event targets, worker threads,
and Worker/SharedWorker host error dispatch. Remove once listeners before
calling author code so a reentrant registration remains active.

Cover listener replacement, abort, object callbacks, nested dispatch,
realm retirement, and actual worker message and error delivery.
This commit is contained in:
ldm0
2026-11-21 20:03:21 +08:00
parent 30ec844f09
commit a39f3faab5
@@ -85,6 +85,7 @@ mod service_worker_drain;
mod session_description;
mod shadow_root_init;
mod simple_event_dispatch;
mod simple_event_dispatch;
mod simple_event_target_handlers;
mod simple_handler_object;
mod speech_synthesis;