[webrtc-extensions] headerExtensionsToOffer entries are modifiable which is surprising (#136)

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

== headerExtensionsToOffer entries are modifiable which is surprising ==
The following behavior seems unintentional and surprising:
```js
if (transceiver.headerExtensionsToOffer[0].direction == "sendrecv") {
  transceiver.headerExtensionsToOffer[0].direction = "stopped";
  console.log(transceiver.headerExtensionsToOffer[0].direction); // "stopped"
}
```
This behavior is from the [spec](https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface) using FrozenArray on a dictionary:
```webidl
readonly attribute FrozenArray<RTCRtpHeaderExtensionCapability> headerExtensionsToOffer;
```
Since [array freezing](https://webidl.spec.whatwg.org/#es-frozen-array) is shallow (uses _"[SetIntegrityLevel](https://tc39.es/ecma262/#sec-setintegritylevel)(array, "frozen")"_, same as [Object.freeze](https://tc39.es/ecma262/#sec-object.freeze) —see [fiddle](https://jsfiddle.net/jib1/5dt36qao/)) it only ensures entries cannot be swapped out, but the entries themselves (in this case pojo caches of the dictionary) remain mutable. These mutations are not observable to the user agent, but _are_ observable to JS, which seems confusing. https://github.com/whatwg/webidl/issues/348

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 9 December 2022 21:19:20 UTC