Re: [webrtc-pc] setRemoteDescription and ontrack order of events: SRD before ontrack?

As for the risk of inspecting the `pc` in an event between the effects of setRemoteDescription, but before the SRD's promise's then-callback, I think this is an inherent risk with promises that can't be avoided, regardless of how we write the spec, e.g:
```
Promise.resolve().then(function() {
  console.log("Remote streams: " + pc.getRemoteStreams().length);
});
pc.setRemoteDescription(sdpWithOneRemoteStream).then(function() {
  console.log("setRemoteDescription resolved!");
});
```
Because both promises are resolved before the event loop is empty, I would expect the callbacks to be invoked in order as soon as SRD is done and we get this output:
```
Remote streams: 1
setRemoteDescription resolved!
```

-- 
GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1508#issuecomment-318023926 using your GitHub account

Received on Wednesday, 26 July 2017 11:15:26 UTC