[mediacapture-screen-share] CaptureController.setFocusBehavior() while promise pending or after it is rejected (#252)

eladalon1983 has just created a new issue for https://github.com/w3c/mediacapture-screen-share:

== CaptureController.setFocusBehavior() while promise pending or after it is rejected ==
The use cases we had in mind for CaptureController.setFocusBehavior() were:
1) Calling setFocusBehavior() before getDisplayMedia() is called.
2) Calling setFocusBehavior() immediately after getDisplayMedia()'s promise is resolved.

There are two additional options which we did not explicitly consider:
3) Calling setFocusBehavior() after the promise is rejected.
4) Calling setFocusBehavior() while the promise is pending.

As a **thought experiment**, we could consider handling both of these by prefixing the current setFocusBehavior() steps with the following step:

> Run the following steps:
> 1. If [[IsBound]] is true and [[Source]] is null, throw an "InvalidStateError" DOMException.
> ...  // Continue with the existing steps.

It's a small change. I think it will be uncontroversial that this handles (3) in a desirable manner, but probably not (4), as developers will likely find it confusing that setFocusBehavior() cannot be called while the promise is pending, but then it's callable again after the promise resolves.

I think we should throw if (3), but make (4) equivalent to (1).
**Call to action:** Do we agree on this?

Assuming we do agree - what's the most elegant way of getting this into the spec? Ideally, we'd not need to replace all of gDM's "return a promise rejected with X" steps with "if there is a controller, set some internal slot to a value, and regardless of the presence of a controller, return a promise rejected with X."

Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/252 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 October 2022 15:08:14 UTC