W3C home > Mailing lists > Public > public-webrtc@w3.org > May 2017

[webrtc-pc] pc.removeTrack(receiver) should throw an error.

From: jan-ivar via GitHub <sysbot+gh@w3.org>
Date: Wed, 31 May 2017 16:31:09 +0000
To: public-webrtc@w3.org
Message-ID: <issues.opened-232623838-1496248267-sysbot+gh@w3.org>
jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== pc.removeTrack(receiver) should throw an error. ==
Currently,
```js
pc.removeTrack(pc.getReceivers()[0]);
```
would according to the spec not throw an error, as it would appear to get past this argument validation the [removeTrack](http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-removetrack) algorithm:

 1. Let *sender* be the argument to removeTrack.
 2. ...
 3. ...
 4. If *sender* was not created by connection, throw an `InvalidAccessError`.

because a receiver is technically created by connection. It instead gets kicked out by step 5:

 5. If sender is not in senders (which indicates that it was removed due to setting an RTCSessionDescription of type "rollback"), then abort these steps.

which means there's no error. I think we should throw an error here, to catch this mistake, to help people grok the model.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1275 using your GitHub account
Received on Wednesday, 31 May 2017 16:31:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:51 UTC