W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > December 2022

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

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Fri, 09 Dec 2022 21:19:18 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issues.opened-1487467459-1670620755-sysbot+gh@w3.org>
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:
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:
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

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:59 UTC