w3c / mediacapture-surface-control

Web API allowing capturing applications limited control over captured surfaces.
https://w3c.github.io/mediacapture-surface-control/
Other
9 stars 1 forks source link

What value should `Event.isTrusted` have? #1

Closed rowan-m closed 4 weeks ago

rowan-m commented 1 year ago

Open question: my initial assumption is false as this is modified by a script, but I didn't see it explicitly stated.

eladalon1983 commented 9 months ago

Good question. I'll check some of the ramifications and circle back to this.

eladalon1983 commented 8 months ago

There is a slight discrepancy here between MDN and the spec.

MDN (non-authoritative):

The isTrusted read-only property of the Event interface is a boolean value that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent().

Spec (authoritative):

Returns true if event was dispatched by the user agent, and false otherwise.

I'd say that these events are dispatched by the user agent; that the user agent does so in response to a script running in another tab does not seem to me to materially change the case. So I'd argue that isTrusted should be true here. Wdyt?

guidou commented 4 months ago

Returns true if event was dispatched by the user agent, and false otherwise.

I'd say that these events are dispatched by the user agent; that the user agent does so in response to a script running in another tab does not seem to me to materially change the case. So I'd argue that isTrusted should be true here. Wdyt?

Under this definition and interpretation, is it possible for isTrusted to ever be false? How can an event not be dispatched by the UA?

guidou commented 4 months ago

Found this note in the spec, which coincides with the MDN explanation (at least the second part):

isTrusted is a convenience that indicates whether an event is dispatched by the user agent (as opposed to using dispatchEvent()). The sole legacy exception is click(), which causes the user agent to dispatch an event whose isTrusted attribute is initialized to false.