Skip to content

Commit

Permalink
Guard setSelected with ProposalPending slot.
Browse files Browse the repository at this point in the history
This avoids a race condition where an application might cause
state to change from within an event handler.
  • Loading branch information
sam-vi committed Sep 5, 2023
1 parent 9565680 commit b89e3f3
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ <h3>
Let |candidatePair:RTCIceCandidatePair| be the candidate pair which is being {{nominated}}.
</p>
</li>
<li>
<p>
Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to <code>true</code>.
</p>
</li>
<li>
<p>
Let |accepted:boolean| be the result of [= fire an event | firing an event =] named
Expand All @@ -755,6 +760,11 @@ <h3>
|candidatePair|.
</p>
</li>
<li>
<p>
Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to <code>false</code>.
</p>
</li>
<li>
<p>
If |accepted| is <code>false</code>, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and
Expand Down Expand Up @@ -820,6 +830,11 @@ <h3>
Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this candidate pair.
</p>
</li>
<li>
<p>
If |transport|.{{RTCIceTransport/[[ProposalPending]]}} is <code>true</code>, [= exception/throw =] an {{InvalidStateError}}.
</p>
</li>
<li>
<p>
If <var>transport</var>.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"controlled"}}, [= exception/throw =] a
Expand Down Expand Up @@ -904,6 +919,11 @@ <h3>
<code>false</code> otherwise.
</p>
</li>
<li>
<p>
Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to <code>true</code>.
</p>
</li>
<li>
<p>
Let |accepted:boolean| be the result of [= fire an event | firing an event =] named
Expand All @@ -913,6 +933,11 @@ <h3>
of |candidatePair|.
</p>
</li>
<li>
<p>
Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to <code>false</code>.
</p>
</li>
<li>
<p>
If |accepted| is <code>false</code>, instruct the [= ICE agent =] to not remove the candidate pair indicated by
Expand All @@ -927,11 +952,14 @@ <h3>
</li>
</ol>
<p>
The {{RTCIceTransport}} object is extended by adding the following internal slot:
The {{RTCIceTransport}} object is extended by adding the following internal slots:
</p>
<ul>
<li>
<dfn data-dfn-for="RTCIceTransport">[[\CandidatePairNominated]]</dfn> initialized to <var>false</var>.
<dfn data-dfn-for="RTCIceTransport">[[\CandidatePairNominated]]</dfn> initialized to <code>false</code>.
</li>
<li>
<dfn data-dfn-for="RTCIceTransport">[[\ProposalPending]]</dfn> initialized to <code>false</code>.
</li>
</ul>
<pre class="idl">
Expand Down Expand Up @@ -996,7 +1024,7 @@ <h2>Methods</h2>
<p>
The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets
will be
sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] must run
sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] MUST run
the
steps to [= change the selected candidate pair =].
</p>
Expand Down

0 comments on commit b89e3f3

Please sign in to comment.