Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTCIceCandidate constructor shim throwing error if ufrag given for Firefox beta (111) #1122

Closed
paisl3y opened this issue Feb 21, 2023 · 6 comments · Fixed by #1123
Closed

Comments

@paisl3y
Copy link

paisl3y commented Feb 21, 2023

Please read first!

Please use discuss-webrtc for general technical discussions and questions.

  • [ x] I have provided steps to reproduce (e.g. a link to a jsfiddle)
  • [ x] I have provided browser name, version and adapter.js version
  • [ x] This issue only happens when adapter.js is used

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.

Versions affected

Firefox (Beta) version 111.0b3 (64-bit)
[email protected]

Description

RTCIceCandidate() constructor throws the below error when ufrag supplied on the candidate line.

TypeError: setting getter-only property "usernameFragment"
RTCIceCandidate common_shim.js:35
debugger eval code:1

Error is not seen in current stable Firefox (v110). No error is thrown if ufrag is not given.

Steps to reproduce

Try creating RTCIceCandidate using the following candidateInfo:

new RTCIceCandidate({ candidate: 'candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host generation 0 ufrag iTuJ network-id 1', sdpMid: 0 })

Expected results

Newly created RTCIceCandidate object returned.

Actual results

The following error is thrown:
TypeError: setting getter-only property "usernameFragment"
RTCIceCandidate common_shim.js:35
debugger eval code:1

@fippo
Copy link
Member

fippo commented Feb 22, 2023

@jan-ivar Firefox breaking like this doesn't sound good? Past attempts by Chromium to enforce read-onlyness of attributes (in particular RTCSessionDescription's sdp) turned out to break too much for no gain.

@fippo
Copy link
Member

fippo commented Feb 22, 2023

Related Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1812346

@jan-ivar
Copy link
Collaborator

jan-ivar commented Feb 22, 2023

The bug is in adapter.js here:

  const nativeCandidate = new NativeRTCIceCandidate(args);
  const parsedCandidate = SDPUtils.parseCandidate(args.candidate);
 const augmentedCandidate = Object.assign(nativeCandidate, parsedCandidate); // TypeError

TIL the difference between:

  1. assignment to a read-only attribute, which is ignored and doesn't throw, vs.
  2. Object.assign which does: "In case of an error, for example if a property is non-writable, a TypeError is raised".

This fiddle shows the latter throwing in all browsers including Firefox 111+, so unfortunately this shim, which was specific to Firefox, was relying on non-standard behavior of Firefox 110 and earlier.

We'll back out the fix that broke adapter in Firefox 111 beta for now, to give adapter time to fix this, and for all users of adapter to update (which may be a while).

@fippo
Copy link
Member

fippo commented Feb 22, 2023

The fix is going to say

const nativeCandidate = new NativeRTCIceCandidate(args);
const parsedCandidate = SDPUtils.parseCandidate(args.candidate);
const augmentedCandidate = Object.assign({}, nativeCandidate, parsedCandidate);

right?

Adoption is going to be a problem, there is still a lot of usage on version 7 and not even 8.
You might consider not doing this until you implement attribute parsing, in particular foundation which is what prevents this from happening in Chrome.

@jan-ivar
Copy link
Collaborator

jan-ivar commented Feb 22, 2023

That would return the wrong type I fear. [Deleted: pilot error since I forgot RTCIceCandidate has a custom toJSON]

Agreed about adoption.

@fippo
Copy link
Member

fippo commented Feb 24, 2023

Thank you for backing this out @jan-ivar! I agree with the plan to reland we lets still try to get #1123 out

fippo added a commit that referenced this issue Mar 12, 2023
… shim (#1123)

* Firefox: do not attempt to modify read-only property in ice candidate shim

fixes #1122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants