W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > June 2019

[webrtc-pc] SLD without {sdp} reads [[LastCreatedOffer/Answer]] at the wrong time (#2208)

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Fri, 14 Jun 2019 00:41:50 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issues.opened-456011558-1560472909-sysbot+gh@w3.org>
jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== SLD without {sdp} reads [[LastCreatedOffer/Answer]] at the wrong time ==
The current prose on [setLocalDescription](https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription) reads **[[LastCreatedOffer]]** and **[[LastCreatedAnswer]]** on method entry. This is the wrong time, and may produce the wrong result if other methods are enqueued. For example, it would fail in the [FIFO peer](https://docs.google.com/presentation/d/1UrXARLbAfwmfK686rX_9W_-FGIc62ZDwVd079wIoX7I/edit?ts=5cdd966f#slide=id.g5b048ace1b_21_24) case:
```js
io.onmessage = async ({data: {description, candidate}}) => {
  if (description) {
    await Promise.all([                           // ←- avoids race!
      pc.setRemoteDescription(description),       // ←- 
      pc.createAnswer(),                          // ←- 
      pc.setLocalDescription({type: "answer"})    // ←- unusual, works today
    ]);                                           // ←- 
```
Here, all three promise-returning negotiation methods are invoked at the same time, which means `setLocalDescription` would read `[[LastCreatedAnswer]]` before the *createAnswer* has succeeded (or even begun the in-parallel part of its algorithm). This would cause SLD to either fail (if `[[LastCreatedAnswer]]` was `null`, or apply an outdated answer.

Instead, we need to read these internal slots in the enqueued steps.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2208 using your GitHub account
Received on Friday, 14 June 2019 00:41:52 UTC

This archive was generated by hypermail 2.3.1 : Friday, 14 June 2019 00:41:53 UTC