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

RTCSessionDescriptionInit vs "local" RTCLocalSessionDescriptionInit #2940

Closed
jarrodcolburn opened this issue Feb 20, 2024 · 2 comments
Closed
Labels

Comments

@jarrodcolburn
Copy link

As mentioned in #2528 "cost of some spec duplication. (a new RTCLocalSessionDescriptionInit)."

Problem: Dart Language web bindings which are generated from IDL is having an issue where RTCLocalSessionDescriptionInit and RTCSessionDescriptionInit are unique, and neither class implements the other. This seems inconsistent with MDN and actual usage.

Any help would be greatly appreciated in editing the doc @henbos @Orphis

@jan-ivar
Copy link
Member

RTCSessionDescriptionInit differs from RTCLocalSessionDescriptionInit by its type member being required:

dictionary RTCSessionDescriptionInit {
  required RTCSdpType type;
  DOMString sdp = "";
};

vs.

dictionary RTCLocalSessionDescriptionInit {
  RTCSdpType type;
  DOMString sdp = "";
};

This is what allows description to be optional in sLD but not in sRD:

  Promise<undefined> setLocalDescription(optional RTCLocalSessionDescriptionInit description = {});
  Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description);

...which is observable:

pc.setLocalDescription(); // fine
pc.setLocalDescription({type: "rollback"}); // fine
pc.setRemoteDescription({type: "rollback"}); // also fine
pc.setRemoteDescription(); // TypeError

RTCPeerConnection.prototype.setLocalDescription.length // 0
RTCPeerConnection.prototype.setRemoteDescription.length // 1

So this is by design.

Problem: Dart Language web bindings which are generated from IDL is having an dart-lang/web#178 where RTCLocalSessionDescriptionInit and RTCSessionDescriptionInit are unique, and neither class implements the other. This seems inconsistent with MDN and actual usage.

WebIDL dictionaries are not classes or interfaces: "an operation that accepts a dictionary as an argument will perform a one-time conversion from the given JavaScript value into the dictionary, based on the current properties of the JavaScript object"

IOW member-compatible inputs are valid, making RTCSessionDescriptionInit valid input to a method expecting RTCLocalSessionDescriptionInit.

If the Dart Language web bindings cannot express this then that seems like a limitation of those bindings.

@jan-ivar
Copy link
Member

Closing as answered. Please reopen if you have further questions.

@jan-ivar jan-ivar closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants