- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Mon, 02 May 2022 21:22:04 +0000
- To: public-webrtc-logs@w3.org
jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-handle: == Specify event handling with algorithms == _"The user agent fires an event"_ is under-specified, in ways that raises questions around timing. Event handling is [tricky](https://w3ctag.github.io/design-principles/#guard-against-recursion) and requires algorithms, since JS isn't allowed to observe things progressing in background processes naturally. For external occurrences, I recommend [what WebRTC uses](https://w3c.github.io/webrtc-pc/#dfn-remotecertificates) (as a minimum): * When _something happens_, the user agent MUST [queue a task](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task) that runs the following steps: * Check state, and abort these steps if unnecessary * Update JS-observable state * [Fire an event](https://dom.spec.whatwg.org/#concept-event-fire) named `foo` at _target_. * Don't do anything after this (to avoid UAFs) This makes it easy to abide by [the following design rule](https://w3ctag.github.io/design-principles/#state-and-subclassing): _"Where possible, use a plain [Event](https://dom.spec.whatwg.org/#event) with a specified type, and capture any state information in the [target](https://dom.spec.whatwg.org/#dom-event-target) object."_ — because state is updated on the same task the event fires on (dispatch is synchronous). Please view or discuss this issue at https://github.com/w3c/mediacapture-handle/issues/56 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 2 May 2022 21:22:05 UTC