Open Bug 1602529 Opened 5 years ago Updated 9 months ago

SLD promise resolves too late (masking errors in perfect negotiation)

Categories

(Core :: WebRTC: Signaling, defect, P3)

Unspecified
All
defect

Tracking

()

People

(Reporter: jib, Unassigned)

References

Details

STR: Open https://jsfiddle.net/jib1/t6vwsr7y/

pc.onsignalingstatechange = () => console.log(pc.signalingState);

const p1 = pc.setLocalDescription(outgoingOffer);
const p2 = pc.setRemoteDescription(incomingOffer);
await p1;
console.log(`After await SLD: ${pc.signalingState}`);
await p2;
console.log(`After await SRD: ${pc.signalingState}`);

Expected result:

have-local-offer
After await SLD: have-local-offer
stable
have-remote-offer
After await SRD: have-remote-offer

Actual result:

have-local-offer
stable
After await SLD: stable
have-remote-offer
After await SRD: have-remote-offer

The SLD promise appears resolved too late. A variant of this is https://jsfiddle.net/jib1/x3q75e8k/ which slips even further:

const p1 = Promise.all([pc.createOffer(), pc.setLocalDescription({type: "offer"})]);
const p2 = pc.setRemoteDescription(incomingOffer);
have-local-offer
stable
have-remote-offer
After await SLD: have-remote-offer
After await SRD: have-remote-offer

This was masking errors in perfect negotiation in Firefox (conveniently sending a null description on initial collision):

impolite: 34: ONN srcdoc:16:13
impolite: 34: ONN Work around setLocalDescription() srcdoc:16:13
impolite: 38: MSG Incoming offer, state=stable, collision=true, polite=false srcdoc:16:13
impolite: 50: ONN STATE current=NULL, pending=NULL srcdoc:16:13
impolite: 51: ONN SEND NULL in have-remote-offer srcdoc:16:13
Priority: -- → P2
Severity: normal → S3
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.