- From: Jan-Ivar Bruaroey via GitHub <noreply@w3.org>
- Date: Thu, 10 Jul 2025 21:42:06 +0000
- To: public-webrtc-logs@w3.org
jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc: == RTCError constructor fails the copy constructor pattern == WebRTC generally follows the Event copy-constructor pattern for all its events, as well as its light data-holder interfaces like - [RTCIceCandidate](https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate) - [RTCSessionDescription](https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription) - Even [RTCError](https://w3c.github.io/webrtc-pc/#dom-rtcerror) However, the latter misses the mark as it doesn't allow initializing members to `null`, causing side-effects (coersion to `0`). [Codepen](https://codepen.io/jib1/pen/Byoaqod?editors=0010): ```js const e1 = new RTCError({errorDetail: "data-channel-failure"}, "foo"); const e2 = new RTCError(e1, e1.message); [ "name", "message", "sdpLineNumber", "sctpCauseCode", "receivedAlert", "sentAlert" ].forEach(name => test(t => assert_equals(e2[name], e1[name], name))); ``` ``` PASS undefined PASS undefined FAIL undefined: sdpLineNumber - Expected null, got 0 failed FAIL undefined: sctpCauseCode - Expected null, got 0 failed FAIL undefined: receivedAlert - Expected null, got 0 failed FAIL undefined: sentAlert - Expected null, got 0 failed 2/6 tests passed PASS finished ``` This seems easily fixed by changing [RTCErrorInit](https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit) to accept `null` as member inputs. Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/3064 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 10 July 2025 21:42:07 UTC