Skip to content

Commit

Permalink
Make pc.localDescription etc. attributes behave like data properties …
Browse files Browse the repository at this point in the history
…in nightly.

Differential Revision: https://phabricator.services.mozilla.com/D203048

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1882399
gecko-commit: 16deaea50bc5c978fe1e3de1175808d4da440d62
gecko-reviewers: bwc
  • Loading branch information
jan-ivar authored and moz-wptsync-bot committed Mar 11, 2024
1 parent 98376f5 commit 1387c7a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion webrtc/RTCPeerConnection-createOffer.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
.then(() => {
assert_equals(pc.signalingState, 'have-local-offer');
assert_session_desc_similar(pc.localDescription, offer);
assert_session_desc_similar(pc.pendingLocalDescription, offer);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.currentLocalDescription, null);

assert_array_equals(states, ['have-local-offer']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
await promise;
assert_not_equals(pc.pendingLocalDescription, null,
'pendingLocalDescription is not null after await');
assert_equals(pc.pendingLocalDescription, pc.localDescription);
}, "pendingLocalDescription is surfaced at the right time");

promise_test(async t => {
Expand All @@ -34,6 +35,7 @@
await promise;
assert_not_equals(pc.pendingRemoteDescription, null,
'pendingRemoteDescription is not null after await');
assert_equals(pc.pendingRemoteDescription, pc.remoteDescription);
}, "pendingRemoteDescription is surfaced at the right time");

promise_test(async t => {
Expand All @@ -55,6 +57,7 @@
await promise;
assert_not_equals(pc2.currentLocalDescription, null,
'currentLocalDescription is not null after await');
assert_equals(pc2.currentLocalDescription, pc2.localDescription);
}, "currentLocalDescription is surfaced at the right time");

promise_test(async t => {
Expand All @@ -76,6 +79,7 @@
await promise;
assert_not_equals(pc1.currentRemoteDescription, null,
'currentRemoteDescription is not null after await');
assert_equals(pc1.currentRemoteDescription, pc1.remoteDescription);
}, "currentRemoteDescription is surfaced at the right time");

</script>
14 changes: 7 additions & 7 deletions webrtc/RTCPeerConnection-setLocalDescription-answer.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
assert_session_desc_similar(pc.localDescription, answer);
assert_session_desc_similar(pc.remoteDescription, offer);

assert_session_desc_similar(pc.currentLocalDescription, answer);
assert_session_desc_similar(pc.currentRemoteDescription, offer);
assert_equals(pc.currentLocalDescription, pc.localDescription);
assert_equals(pc.currentRemoteDescription, pc.remoteDescription);

assert_equals(pc.pendingLocalDescription, null);
assert_equals(pc.pendingRemoteDescription, null);
Expand Down Expand Up @@ -107,8 +107,8 @@
assert_session_desc_similar(pc.localDescription, answer);
assert_session_desc_similar(pc.remoteDescription, offer);

assert_session_desc_similar(pc.currentLocalDescription, answer);
assert_session_desc_similar(pc.currentRemoteDescription, offer);
assert_equals(pc.currentLocalDescription, pc.localDescription);
assert_equals(pc.currentRemoteDescription, pc.remoteDescription);

assert_equals(pc.pendingLocalDescription, null);
assert_equals(pc.pendingRemoteDescription, null);
Expand Down Expand Up @@ -204,7 +204,7 @@
assert_equals(pc2.pendingLocalDescription, null, "pendingLocalDescription should never be set due to sLD(answer)");
assert_not_equals(pc2.pendingRemoteDescription, null, "pendingRemoteDescription should not be set synchronously after a call to sLD");
assert_equals(pc2.pendingRemoteDescription.type, "offer");
assert_equals(pc2.remoteDescription.sdp, pc2.pendingRemoteDescription.sdp);
assert_equals(pc2.remoteDescription, pc2.pendingRemoteDescription);
assert_equals(pc2.currentLocalDescription, null, "currentLocalDescription should not be set synchronously after a call to sLD");
assert_equals(pc2.currentRemoteDescription, null, "currentRemoteDescription should not be set synchronously after a call to sLD");

Expand All @@ -219,10 +219,10 @@
assert_equals(pc2.pendingRemoteDescription, null, "pendingRemoteDescription should be updated before the signalingstatechange event");
assert_not_equals(pc2.currentLocalDescription, null, "currentLocalDescription should be updated before the signalingstatechange event");
assert_equals(pc2.currentLocalDescription.type, "answer");
assert_equals(pc2.currentLocalDescription.sdp, pc2.localDescription.sdp);
assert_equals(pc2.currentLocalDescription, pc2.localDescription);
assert_not_equals(pc2.currentRemoteDescription, null, "currentRemoteDescription should be updated before the signalingstatechange event");
assert_equals(pc2.currentRemoteDescription.type, "offer");
assert_equals(pc2.currentRemoteDescription.sdp, pc2.remoteDescription.sdp);
assert_equals(pc2.currentRemoteDescription, pc2.remoteDescription);

await sldPromise;
}, "setLocalDescription(answer) should update internal state with a queued task, in the right order");
Expand Down
6 changes: 3 additions & 3 deletions webrtc/RTCPeerConnection-setLocalDescription-offer.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
.then(() => {
assert_equals(pc.signalingState, 'have-local-offer');
assert_session_desc_similar(pc.localDescription, offer);
assert_session_desc_similar(pc.pendingLocalDescription, offer);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.currentLocalDescription, null);

assert_array_equals(states, ['have-local-offer']);
Expand All @@ -90,7 +90,7 @@
.then(() => {
assert_equals(pc.signalingState, 'have-local-offer');
assert_session_desc_similar(pc.localDescription, offer);
assert_session_desc_similar(pc.pendingLocalDescription, offer);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.currentLocalDescription, null);
}));
}, 'setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer');
Expand Down Expand Up @@ -219,7 +219,7 @@
assert_equals(pc.pendingRemoteDescription, null, "pendingRemoteDescription should never be set due to sLD");
assert_not_equals(pc.pendingLocalDescription, null, "pendingLocalDescription should be updated before the signalingstatechange event");
assert_equals(pc.pendingLocalDescription.type, "offer");
assert_equals(pc.pendingLocalDescription.sdp, pc.localDescription.sdp);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.currentLocalDescription, null, "currentLocalDescription should never be updated due to sLD(offer)");
assert_equals(pc.currentRemoteDescription, null, "currentRemoteDescription should never be updated due to sLD(offer)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

await offerer.setLocalDescription();
assert_not_equals(offerer.pendingLocalDescription, null);
assert_equals(offerer.pendingLocalDescription, offerer.pendingLocalDescription);
}, "Parameterless SLD() in 'stable' sets pendingLocalDescription");

promise_test(async t => {
Expand Down Expand Up @@ -63,6 +64,7 @@
await answerer.setRemoteDescription(await offerer.createOffer());
await answerer.setLocalDescription();
assert_not_equals(answerer.currentLocalDescription, null);
assert_equals(answerer.currentLocalDescription, answerer.currentLocalDescription);
}, "Parameterless SLD() in 'have-remote-offer' sets currentLocalDescription");

promise_test(async t => {
Expand Down
6 changes: 3 additions & 3 deletions webrtc/RTCPeerConnection-setLocalDescription-rollback.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html

// The following helper functions are called from RTCPeerConnection-helper.js:
// assert_session_desc_similar
// generateAudioReceiveOnlyOffer

/*
Expand Down Expand Up @@ -68,7 +67,8 @@
.then(() => {
assert_equals(pc.signalingState, 'have-local-offer');
assert_not_equals(pc.localDescription, null);
assert_not_equals(pc.pendingLocalDescription, null);
assert_equals(pc.localDescription, pc.localDescription);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.currentLocalDescription, null);

return pc.setLocalDescription({ type: 'rollback' });
Expand Down Expand Up @@ -148,7 +148,7 @@

assert_not_equals(pc.pendingLocalDescription, null, "pendingLocalDescription should not be set synchronously after a call to sLD");
assert_equals(pc.pendingLocalDescription.type, "offer");
assert_equals(pc.pendingLocalDescription.sdp, pc.localDescription.sdp);
assert_equals(pc.pendingLocalDescription, pc.localDescription);
assert_equals(pc.pendingRemoteDescription, null, "pendingRemoteDescription should never be set due to sLD(offer)");

const stablePromise = new Promise(resolve => {
Expand Down
7 changes: 4 additions & 3 deletions webrtc/RTCPeerConnection-setRemoteDescription-offer.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
assert_equals(raceValue, "have-remote-offer", "signalingstatechange event should fire before sRD resolves");
assert_not_equals(pc2.pendingRemoteDescription, null, "pendingRemoteDescription should be updated before the signalingstatechange event");
assert_equals(pc2.pendingRemoteDescription.type, "offer");
assert_equals(pc2.pendingRemoteDescription.sdp, pc2.remoteDescription.sdp);
assert_equals(pc2.pendingRemoteDescription, pc2.remoteDescription);
assert_equals(pc2.currentRemoteDescription, null, "currentRemoteDescription should not be set after a call to sRD(offer)");

await srdPromise;
Expand All @@ -236,7 +236,7 @@
assert_equals(pc2.pendingRemoteDescription, null, "pendingRemoteDescription should not be set synchronously after a call to sRD");
assert_not_equals(pc2.pendingLocalDescription, null, "pendingLocalDescription should not be set synchronously after a call to sRD");
assert_equals(pc2.pendingLocalDescription.type, "offer");
assert_equals(pc2.pendingLocalDescription.sdp, pc2.localDescription.sdp);
assert_equals(pc2.pendingLocalDescription, pc2.localDescription);

// First, we should go through stable (the implicit rollback part)
const stablePromise = new Promise(resolve => {
Expand All @@ -260,7 +260,8 @@
assert_equals(raceValue, "have-remote-offer", "signalingstatechange event should fire before sRD resolves");
assert_not_equals(pc2.pendingRemoteDescription, null, "pendingRemoteDescription should be updated before the signalingstatechange event");
assert_equals(pc2.pendingRemoteDescription.type, "offer");
assert_equals(pc2.pendingRemoteDescription.sdp, pc2.remoteDescription.sdp);
assert_equals(pc2.pendingRemoteDescription, pc2.remoteDescription);
assert_equals(pc2.pendingRemoteDescription, pc2.pendingRemoteDescription);
assert_equals(pc2.pendingLocalDescription, null, "pendingLocalDescription should be updated before the signalingstatechange event");

await srdPromise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
.then(() => {
assert_equals(pc.signalingState, 'have-remote-offer');
assert_not_equals(pc.remoteDescription, null);
assert_not_equals(pc.pendingRemoteDescription, null);
assert_equals(pc.pendingRemoteDescription, pc.remoteDescription);
assert_equals(pc.currentRemoteDescription, null);

return pc.setRemoteDescription({type: 'rollback'});
Expand Down
2 changes: 1 addition & 1 deletion webrtc/RTCPeerConnection-setRemoteDescription.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
await pc2.setLocalDescription(answer);
await pc.setRemoteDescription(answer);
await exchangeOffer(pc2, pc);
assert_equals(pc.remoteDescription.sdp, pc.pendingRemoteDescription.sdp);
assert_equals(pc.remoteDescription, pc.pendingRemoteDescription);
assert_session_desc_similar(pc.remoteDescription, offer);
assert_session_desc_similar(pc.currentRemoteDescription, answer);
}, 'Switching role from offerer to answerer after going back to stable state should succeed');
Expand Down

0 comments on commit 1387c7a

Please sign in to comment.