Promises resolution not defined #463

Closed
murillo128 opened this Issue Apr 11, 2016 · 5 comments

Projects

None yet

3 participants

@murillo128

Several methods of the ORTC objects return a promise, but it is not defined when they are resolved nor what value is it resolved to.

For example:

setTrack
Attempts to replace the track being sent with another track provided.

When the setTrack() method is invoked, the user agent must run the following steps:

1. Let p be a new promise.

2. Let withTrack be the argument to this method.

3. Run the following steps asynchronously:

    1. If withTrack.kind differs from RTCRtpSender.track.kind or if withTrack has different peerIdentity constraints, then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    2. If withTrack.readyState is "ended" then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    3. Set the RTCRtpSender.track attribute to withTrack, and have the sender seamlessly switch to transmitting withTrack in place of what it is sending. On the remote receiving end, the track maintains its existing grouping and id until the connection ends.

It is assumed that the the promise will be resolved on async-3 step with an undefined (?) value, but this should be explicitly said, as for example:

3. Run the following steps asynchronously:

    1. If withTrack.kind differs from RTCRtpSender.track.kind or if withTrack has different peerIdentity constraints, then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    2. If withTrack.readyState is "ended" then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    3. Set the RTCRtpSender.track attribute to withTrack, and have the sender seamlessly switch to transmitting withTrack in place of what it is sending. On the remote receiving end, the track maintains its existing grouping and id until the connection ends.
    4. Resolve p with withTrack value
@murillo128

Also we should add the promise resolved value in the definition, changing:

Promise                   setTrack (MediaStreamTrack track);

by

Promise<void>                  setTrack (MediaStreamTrack track);
@robin-raymond robin-raymond added the 1.1 label Apr 13, 2016
@robin-raymond
Contributor

Currently, when a promise is not returning a specific value we just return Promise. The IDL will need to be verified to ensure the correct practices are followed for all promises.

@murillo128

Here is the w3c best practices guide on promises:

https://www.w3.org/2001/tag/doc/promises-guide
El 13/4/2016 23:22, "Robin Raymond" notifications@github.com escribió:

Currently, when a promise is not returning a specific value we just return
Promise. The IDL will need to be verified to ensure the correct practices
are followed for all promises.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#463 (comment)

@robin-raymond
Contributor

Correct, 7.4 has examples as such:

interface ProtectedResource {
  Promise<void> requestAccess();
  // ...
};
@aboba aboba added PR exists and removed to-do-next-draft labels Apr 25, 2016
@robin-raymond
Contributor

Looks better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment