adapter
adapter copied to clipboard
shimAddIceCandidateNullOrEmpty fails on Safari 17.0
- [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
Versions affected
Browser name including version (e.g. Chrome 64.0.3282.119)
Safari 17.0 (19616.1.27.111.16)
adapter.js (e.g. 6.1.0)
All versions >=8.0.0
Description
The shimAddIceCandidateNullOrEmpty
step fails on Safari. This particular check breaks (len==0):
https://github.com/webrtcHacks/adapter/blob/28c9f9471cb3df75cbb978c6f840e3315731790f/release/adapter.js#L1480-L1482
Causing this API to not be replaced correctly. This breaks the empty-candidate scenario, causing an error to be thrown.
Steps to reproduce
- Insert https://webrtc.github.io/adapter/adapter-latest.js into your site (via
- Insert debugger breakpoint at line mentioned above
- See shim failing to be correctly applied.
We encountered this bug when testing https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api on Safari, where we depend on the empty-candidate scenario to work correctly.
Note: when pausing with the debugger and refreshing right after, it sometimes actually passes that check and the shim works correctly, once in 20 tries I'd say. Might be a Safari bug for all it's worth.
Expected results
The addIceCandidate
is correctly modified to have Safari handle the empty candidate scenario fine.
Actual results
addIceCandidate
is not modified, causing Safari to throw an error when encountering an empty candidate string.
Also tested on Safari on iOS 17 - same thing happens.
@youennf that seems like a regression?
To maybe speed things up - this is almost certainly a Safari bug.
As it is right now, window.RTCPeerConnection.prototype.addIceCandidate
has length: 0, name: "addIceCandidate"
.
When I add a 3s delay before calling shimAddIceCandidateNullOrEmpty
, about 80% of the time a different function appears with length: 3, name: "withCallback"
and the shim is correctly applied. It's inconsistent though, no matter how long the delay is, sometimes the signature is just incorrect anyway.
Any ideas on how to proceed with this?