[webrtc-pc] onnegotiationneeded still races with onmessage under stress (#2508)

jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== onnegotiationneeded still races with onmessage under stress ==
New perfect negotiation WPT tests reveal ONN may still race with onmessage under stress.
We observe ONN firing _during_ `onmessage`. Not POLA. For details see [bug 1628139](https://bugzil.la/1628139).

TL;DR: We specifically chain ONN now to avoid this. The idea was that as long as `onmessage` checks ONN hasn't started (`if (!makingOffer)`) and then immediately calls SRD(offer)—which it must anyway because candidates—then ONN can't interrupt.

But we find that it can when the [updateNegotiationNeeded](https://w3c.github.io/webrtc-pc/#dfn-update-the-negotiation-needed-flag) algorithm is already on the chain. Under stress (e.g. from lots of modification methods), lots of things may be on the chain.

**Proposal:** Only  fire ONN when the chain is/becomes empty.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2508 using your GitHub account

Received on Tuesday, 7 April 2020 23:42:42 UTC