Skip to content
Permalink
Browse files
Signaling state check when applying a local or remote description is …
…no longer aligned with the WebRTC spec

https://bugs.webkit.org/show_bug.cgi?id=229138

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Rebasing tests.
Some tests are going from PASS to FAIL:
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-operations.https.html: we do not support yet rollback.
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html:  is no longer throwing the right exception (and we are not supporting pranswer yet).
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription.html: we are throwing with a different exception.

* web-platform-tests/webrtc/RTCPeerConnection-SLD-SRD-timing.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare-linear.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-restartIce.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-rollback-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt:
* web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:

Source/WebCore:

These checks have been removed from the spec and are no longer valid.
Covered by rebased tests.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setLocalDescription):
(WebCore::PeerConnectionBackend::setRemoteDescription):
(WebCore::isLocalDescriptionTypeValidForState): Deleted.
(WebCore::isRemoteDescriptionTypeValidForState): Deleted.
* testing/MockLibWebRTCPeerConnection.cpp:
(WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
(WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
* testing/MockLibWebRTCPeerConnection.h:

LayoutTests:

* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-stable-expected.txt:


Canonical link: https://commits.webkit.org/240972@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Aug 26, 2021
1 parent ef27e81 commit d6c64edcdde24e8ade13ed005dff1a6027ec60fe
Showing 23 changed files with 164 additions and 98 deletions.
@@ -1,3 +1,13 @@
2021-08-26 Youenn Fablet <youenn@apple.com>

Signaling state check when applying a local or remote description is no longer aligned with the WebRTC spec
https://bugs.webkit.org/show_bug.cgi?id=229138

Reviewed by Eric Carlson.

* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-stable-expected.txt:

2021-08-25 Alex Christensen <achristensen@webkit.org>

Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
@@ -20,8 +20,8 @@ PASS remoteOffer1 set as remote description (again)
FAIL pc.signalingState should be have-remote-offer. Was stable.

*** Try setting local descriptions with bad types for the current state
PASS promise pc.setRemoteDescription({type:'answer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError: Remote description type 2 is incompatible with current signaling state 0
PASS promise pc.setRemoteDescription({type:'pranswer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError: Remote description type 1 is incompatible with current signaling state 0
PASS promise pc.setRemoteDescription({type:'answer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError: The object is in an invalid state.
PASS promise pc.setRemoteDescription({type:'pranswer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError: The object is in an invalid state.

*** Create (remote) offer with video (remoteOffer2)
*** Done, start testing with remoteOffer2
@@ -6,25 +6,25 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS pc.signalingState is "stable"
PASS pc.setLocalDescription(sessionDescription).then(finishIfSucceeded, requestFailed1); did not throw exception.
PASS setLocalDescription failed.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was InvalidStateError.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was OperationError.
FAIL pc.localDescription should throw an exception. Was null.
FAIL pc.remoteDescription should throw an exception. Was null.
PASS pc.signalingState is "stable"
PASS pc.setLocalDescription(sessionDescription).then(finishIfSucceeded, requestFailed2); did not throw exception.
PASS setLocalDescription failed.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was InvalidStateError.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was OperationError.
FAIL pc.localDescription should throw an exception. Was null.
FAIL pc.remoteDescription should throw an exception. Was null.
PASS pc.signalingState is "stable"
PASS pc.setRemoteDescription(sessionDescription).then(finishIfSucceeded, requestFailed3); did not throw exception.
PASS setRemoteDescription failed.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was InvalidStateError.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was SyntaxError.
FAIL pc.localDescription should throw an exception. Was null.
FAIL pc.remoteDescription should throw an exception. Was null.
PASS pc.signalingState is "stable"
PASS pc.setRemoteDescription(sessionDescription).then(finishIfSucceeded, requestFailed4); did not throw exception.
PASS setRemoteDescription failed.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was InvalidStateError.
FAIL errorReason.name should be InvalidSessionDescriptionError. Was SyntaxError.
FAIL pc.localDescription should throw an exception. Was null.
FAIL pc.remoteDescription should throw an exception. Was null.
PASS pc.signalingState is "stable"
@@ -1,3 +1,31 @@
2021-08-26 Youenn Fablet <youenn@apple.com>

Signaling state check when applying a local or remote description is no longer aligned with the WebRTC spec
https://bugs.webkit.org/show_bug.cgi?id=229138

Reviewed by Eric Carlson.

Rebasing tests.
Some tests are going from PASS to FAIL:
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-operations.https.html: we do not support yet rollback.
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html: is no longer throwing the right exception (and we are not supporting pranswer yet).
- LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription.html: we are throwing with a different exception.

* web-platform-tests/webrtc/RTCPeerConnection-SLD-SRD-timing.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare-linear.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-restartIce.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-rollback-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt:
* web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:

2021-08-25 Chris Dumez <cdumez@apple.com>

[Mac wk2] imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/reporting-to-frame-owner.https.html is a flaky failure
@@ -1,3 +1,3 @@

FAIL setLocalDescription and setRemoteDescription are not racy promise_test: Unhandled rejection with value: object "InvalidStateError: Remote description type 0 is incompatible with current signaling state 1"
FAIL setLocalDescription and setRemoteDescription are not racy promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to set remote offer sdp: Called in wrong state: have-local-offer"

@@ -5,7 +5,7 @@ PASS promiseState helper works
PASS promiseStateFinal helper works
FAIL createOffer must detect InvalidStateError synchronously when chain is empty (prerequisite) assert_equals: expected "InvalidStateError" but got "Error"
PASS createAnswer must detect InvalidStateError synchronously when chain is empty (prerequisite)
PASS SLD(rollback) must detect InvalidStateError synchronously when chain is empty
FAIL SLD(rollback) must detect InvalidStateError synchronously when chain is empty assert_equals: promise rejected on same task expected "rejected" but got "pending"
FAIL addIceCandidate must detect InvalidStateError synchronously when chain is empty assert_equals: expected "InvalidStateError" but got "TypeError"
PASS replaceTrack must detect InvalidStateError synchronously when chain is empty and transceiver is stopped
PASS setParameters must detect InvalidStateError synchronously always when transceiver is stopped
@@ -26,7 +26,7 @@ PASS pc.getStats does NOT use the operations chain
PASS sender.getStats does NOT use the operations chain
PASS receiver.getStats does NOT use the operations chain
FAIL addIceCandidate chains onto SRD, fails before assert_equals: expected "InvalidStateError" but got "Error"
FAIL Operations queue not vulnerable to recursion by chained negotiationneeded promise_test: Unhandled rejection with value: object "InvalidStateError: Remote description type 0 is incompatible with current signaling state 1"
FAIL Operations queue not vulnerable to recursion by chained negotiationneeded promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to set remote offer sdp: Called in wrong state: have-local-offer"
FAIL Pack operations queue with implicit offer and answer promise_test: Unhandled rejection with value: object "OperationError: Expect line: v="
TIMEOUT Negotiate solely by operations queue and signaling state Test timed out

@@ -1,4 +1,6 @@

FAIL Perfect negotiation stress glare linear Remote description type 0 is incompatible with current signaling state 1
FAIL Perfect negotiation stress glare linear with roles reversed assert_unreached: Error in iframe: InvalidStateError: Remote description type 0 is incompatible with current signaling state 1 Reached unreachable code
Harness Error (FAIL), message = Unhandled rejection: null is not an object (evaluating 'target.postMessage')

FAIL Perfect negotiation stress glare linear Failed to set remote offer sdp: Called in wrong state: have-local-offer
FAIL Perfect negotiation stress glare linear with roles reversed assert_unreached: Error in iframe: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: have-local-offer Reached unreachable code

@@ -1,4 +1,4 @@

FAIL Perfect negotiation stress glare Remote description type 0 is incompatible with current signaling state 1
FAIL Perfect negotiation stress glare with roles reversed assert_unreached: Error in iframe: InvalidStateError: Remote description type 0 is incompatible with current signaling state 1 Reached unreachable code
FAIL Perfect negotiation stress glare Failed to set remote offer sdp: Called in wrong state: have-local-offer
FAIL Perfect negotiation stress glare with roles reversed assert_unreached: Error in iframe: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: have-local-offer Reached unreachable code

@@ -10,6 +10,6 @@ PASS restartIce() does nothing in initial have-remote-offer
PASS restartIce() survives remote offer
PASS restartIce() is satisfied by remote ICE restart
PASS restartIce() trumps {iceRestart: false}
FAIL restartIce() survives rollback promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
PASS restartIce() survives rollback
FAIL restartIce() survives remote offer containing partial restart assert_false: Restarted 2 expected false got true

@@ -1,8 +1,8 @@

PASS setLocalDescription(offer) with m= section should assign mid to corresponding transceiver
PASS setRemoteDescription(offer) with m= section and no existing transceiver should create corresponding transceiver
FAIL setLocalDescription(rollback) should unset transceiver.mid promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
FAIL setLocalDescription(rollback) should only unset transceiver mids associated with current round promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
FAIL setRemoteDescription(rollback) should remove newly created transceiver from transceiver list promise_test: Unhandled rejection with value: object "InvalidStateError: Remote description type 3 is incompatible with current signaling state 2"
PASS setLocalDescription(rollback) should unset transceiver.mid
PASS setLocalDescription(rollback) should only unset transceiver mids associated with current round
FAIL setRemoteDescription(rollback) should remove newly created transceiver from transceiver list assert_array_equals: Expect transceiver to be removed from pc2's transceiver list lengths differ, expected array [] length 0, got [object "[object RTCRtpTransceiver]"] length 1
PASS setRemoteDescription should set transceiver inactive if its corresponding m section is rejected

@@ -1,9 +1,9 @@

PASS setLocalDescription() with valid answer should succeed
FAIL setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer promise_test: Unhandled rejection with value: object "OperationError: Expect line: v="
FAIL setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "OperationError: Failed to set local answer sdp: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity. Expected: sha-256 0D:E2:FA:94:4D:00:FD:19:00:18:DC:96:C0:5D:20:81:53:91:E1:DE:73:E9:B6:99:A3:64:B9:F1:58:69:81:18 Got: sha-256 94:25:42:B4:B7:8C:8C:F5:DF:C5:ED:6A:82:03:44:0D:4E:1B:0A:B7:76:D6:BE:DA:72:80:7D:3D:6C:78:2B:F3" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
FAIL Calling setLocalDescription(answer) from stable state should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Local description type 2 is incompatible with current signaling state 0" that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
FAIL Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Local description type 2 is incompatible with current signaling state 1" that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
FAIL Setting previously generated answer after a call to createOffer should work promise_test: Unhandled rejection with value: object "InvalidStateError: Remote description type 3 is incompatible with current signaling state 2"
FAIL setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "OperationError: Failed to set local answer sdp: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity. Expected: sha-256 5A:90:E6:76:2B:68:BA:02:57:FC:0E:37:B6:BF:A7:1E:79:58:12:D4:6C:0D:84:CB:08:D2:F7:BB:01:9E:B9:CB Got: sha-256 05:68:D4:79:D9:47:72:10:F1:2A:F8:81:C7:C0:C5:28:4C:9B:B9:90:9A:60:81:E6:2C:31:35:E5:9D:C7:E2:0A" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
FAIL Calling setLocalDescription(answer) from stable state should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Failed to set local answer sdp: no pending remote description." that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
FAIL Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Failed to set local answer sdp: no pending remote description." that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
PASS Setting previously generated answer after a call to createOffer should work
FAIL setLocalDescription(answer) should update internal state with a queued task, in the right order assert_not_equals: pendingRemoteDescription should not be set synchronously after a call to sLD got disallowed value null

@@ -1,10 +1,10 @@

PASS setLocalDescription with valid offer should succeed
FAIL setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer promise_test: Unhandled rejection with value: object "OperationError: Expect line: v="
FAIL setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity. Expected: sha-256 AC:89:BE:E6:A4:DB:0A:BB:A7:A5:85:7E:53:F6:60:11:D8:97:44:6D:D0:A1:4C:32:80:B3:03:94:C8:83:AD:A8 Got: sha-256 34:AF:27:F0:FE:EF:83:BC:1D:76:C6:89:C7:D9:81:7C:C3:FB:DA:F0:04:CF:D3:81:FC:62:FA:9A:84:B5:3B:E8" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
FAIL setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity. Expected: sha-256 CB:DD:6C:16:C3:EB:2B:91:4B:45:55:4F:C1:45:DC:BF:53:7C:F4:4B:F5:07:80:18:31:8A:51:3A:35:0E:36:4C Got: sha-256 DD:D9:E2:F3:33:68:9A:4C:1D:FD:BE:CA:4E:0F:35:78:FC:B5:2A:0A:C8:E5:CD:E2:93:7B:C7:7A:99:C2:31:63" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
FAIL Set created offer other than last offer should reject with InvalidModificationError assert_unreached: Should have rejected: undefined Reached unreachable code
PASS Creating and setting offer multiple times should succeed
FAIL Setting previously generated offer after a call to createAnswer should work promise_test: Unhandled rejection with value: object "InvalidStateError: Remote description type 3 is incompatible with current signaling state 2"
PASS Setting previously generated offer after a call to createAnswer should work
FAIL Negotiation works when there has been a repeated setLocalDescription(offer) assert_equals: expected 1 but got 0
FAIL setLocalDescription(offer) should update internal state with a queued task, in the right order assert_equals: pendingRemoteDescription should never be set due to sLD expected null but got object "[object RTCSessionDescription]"

@@ -1,5 +1,5 @@

PASS setLocalDescription(pranswer) from stable state should reject with InvalidStateError
FAIL setLocalDescription(pranswer) from stable state should reject with InvalidStateError promise_rejects_dom: function "function () { throw e }" threw object "OperationError: Failed to set local pranswer sdp: Called in wrong state: stable" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
FAIL setLocalDescription(pranswer) should succeed assert_equals: expected null but got object "[object RTCSessionDescription]"
PASS setLocalDescription(pranswer) can be applied multiple times while still in have-local-pranswer
PASS setLocalDescription(answer) from have-local-pranswer state should succeed
@@ -1,7 +1,7 @@

FAIL setLocalDescription(rollback) from have-local-offer state should reset back to stable state promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
PASS setLocalDescription(rollback) from have-local-offer state should reset back to stable state
PASS setLocalDescription(rollback) from stable state should reject with InvalidStateError
PASS setLocalDescription(rollback) after setting answer description should reject with InvalidStateError
FAIL setLocalDescription(rollback) should ignore invalid sdp content and succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
FAIL setLocalDescription(rollback) should update internal state with a queued tassk, in the right order promise_test: Unhandled rejection with value: object "InvalidStateError: Local description type 3 is incompatible with current signaling state 1"
PASS setLocalDescription(rollback) should ignore invalid sdp content and succeed
FAIL setLocalDescription(rollback) should update internal state with a queued tassk, in the right order assert_not_equals: pendingLocalDescription should not be set synchronously after a call to sLD got disallowed value null

0 comments on commit d6c64ed

Please sign in to comment.