Title: [144808] trunk
Revision
144808
Author
[email protected]
Date
2013-03-05 13:15:53 -0800 (Tue, 05 Mar 2013)

Log Message

MediaStream API: Allow local and remote descriptions to be accessed after close
https://bugs.webkit.org/show_bug.cgi?id=111437

Reviewed by Adam Barth.

Source/WebCore:

It's quite clear in the standard that the getters should still return the old value.
Also overhauling the state setters a bit to check if the new state is different.

Existing tests expanded to cover patch.

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::localDescription):
(WebCore::RTCPeerConnection::remoteDescription):
(WebCore::RTCPeerConnection::changeSignalingState):
(WebCore::RTCPeerConnection::changeIceGatheringState):
(WebCore::RTCPeerConnection::changeIceConnectionState):

LayoutTests:

Expanding tests to check the new behaviour.

* fast/mediastream/RTCPeerConnection-localDescription-expected.txt:
* fast/mediastream/RTCPeerConnection-localDescription.html:
* fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt:
* fast/mediastream/RTCPeerConnection-remoteDescription.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144807 => 144808)


--- trunk/LayoutTests/ChangeLog	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/LayoutTests/ChangeLog	2013-03-05 21:15:53 UTC (rev 144808)
@@ -1,3 +1,17 @@
+2013-03-05  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Allow local and remote descriptions to be accessed after close
+        https://bugs.webkit.org/show_bug.cgi?id=111437
+
+        Reviewed by Adam Barth.
+
+        Expanding tests to check the new behaviour.
+
+        * fast/mediastream/RTCPeerConnection-localDescription-expected.txt:
+        * fast/mediastream/RTCPeerConnection-localDescription.html:
+        * fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt:
+        * fast/mediastream/RTCPeerConnection-remoteDescription.html:
+
 2013-03-05  Eric Seidel  <[email protected]>
 
         Multiple html5lib Layout Tests are slow since r144032

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt (144807 => 144808)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt	2013-03-05 21:15:53 UTC (rev 144808)
@@ -8,6 +8,9 @@
 PASS pc.setLocalDescription(sessionDescription, requestSucceeded2, requestFailed2); did not throw exception.
 PASS requestFailed was called.
 PASS pc.localDescription.type is "offer"
+PASS pc.localDescription.sdp is "local"
+PASS pc.localDescription.type is "offer"
+PASS pc.localDescription.sdp is "local"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html (144807 => 144808)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html	2013-03-05 21:15:53 UTC (rev 144808)
@@ -13,7 +13,12 @@
 {
     testPassed('requestFailed was called.');
 
-    shouldBe('pc.localDescription.type', '"offer"');
+    shouldBeEqualToString('pc.localDescription.type', "offer");
+    shouldBeEqualToString('pc.localDescription.sdp', "local");
+    pc.close();
+    shouldBeEqualToString('pc.localDescription.type', "offer");
+    shouldBeEqualToString('pc.localDescription.sdp', "local");
+
     finishJSTest();
 }
 

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt (144807 => 144808)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt	2013-03-05 21:15:53 UTC (rev 144808)
@@ -8,6 +8,9 @@
 PASS pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2); did not throw exception.
 PASS requestFailed was called.
 PASS pc.remoteDescription.type is "answer"
+PASS pc.remoteDescription.sdp is "remote"
+PASS pc.remoteDescription.type is "answer"
+PASS pc.remoteDescription.sdp is "remote"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html (144807 => 144808)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html	2013-03-05 21:15:53 UTC (rev 144808)
@@ -13,7 +13,12 @@
 {
     testPassed('requestFailed was called.');
 
-    shouldBe('pc.remoteDescription.type', '"answer"');
+    shouldBeEqualToString('pc.remoteDescription.type', "answer");
+    shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
+    pc.close();
+    shouldBeEqualToString('pc.remoteDescription.type', "answer");
+    shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
+
     finishJSTest();
 }
 

Modified: trunk/Source/WebCore/ChangeLog (144807 => 144808)


--- trunk/Source/WebCore/ChangeLog	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/Source/WebCore/ChangeLog	2013-03-05 21:15:53 UTC (rev 144808)
@@ -1,3 +1,22 @@
+2013-03-05  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Allow local and remote descriptions to be accessed after close
+        https://bugs.webkit.org/show_bug.cgi?id=111437
+
+        Reviewed by Adam Barth.
+
+        It's quite clear in the standard that the getters should still return the old value.
+        Also overhauling the state setters a bit to check if the new state is different.
+
+        Existing tests expanded to cover patch.
+
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::localDescription):
+        (WebCore::RTCPeerConnection::remoteDescription):
+        (WebCore::RTCPeerConnection::changeSignalingState):
+        (WebCore::RTCPeerConnection::changeIceGatheringState):
+        (WebCore::RTCPeerConnection::changeIceConnectionState):
+
 2013-03-05  Charlie Reis  <[email protected]>
 
         Add FrameLoaderClient::didAccessInitialDocument

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (144807 => 144808)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2013-03-05 21:14:17 UTC (rev 144807)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2013-03-05 21:15:53 UTC (rev 144808)
@@ -225,11 +225,6 @@
 
 PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionCode& ec)
 {
-    if (m_signalingState == SignalingStateClosed) {
-        ec = INVALID_STATE_ERR;
-        return 0;
-    }
-
     RefPtr<RTCSessionDescriptionDescriptor> descriptor = m_peerHandler->localDescription();
     if (!descriptor)
         return 0;
@@ -257,11 +252,6 @@
 
 PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionCode& ec)
 {
-    if (m_signalingState == SignalingStateClosed) {
-        ec = INVALID_STATE_ERR;
-        return 0;
-    }
-
     RefPtr<RTCSessionDescriptionDescriptor> descriptor = m_peerHandler->remoteDescription();
     if (!descriptor)
         return 0;
@@ -631,21 +621,26 @@
 
 void RTCPeerConnection::changeSignalingState(SignalingState signalingState)
 {
-    ASSERT(m_signalingState != SignalingStateClosed);
-    m_signalingState = signalingState;
-    scheduleDispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
+    if (m_signalingState != SignalingStateClosed && m_signalingState != signalingState) {
+        m_signalingState = signalingState;
+        scheduleDispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
+    }
 }
 
 void RTCPeerConnection::changeIceGatheringState(IceGatheringState iceGatheringState)
 {
-    m_iceGatheringState = iceGatheringState;
-    scheduleDispatchEvent(Event::create(eventNames().gatheringchangeEvent, false, false));
+    if (m_iceGatheringState != iceGatheringState) {
+        m_iceGatheringState = iceGatheringState;
+        scheduleDispatchEvent(Event::create(eventNames().gatheringchangeEvent, false, false));
+    }
 }
 
 void RTCPeerConnection::changeIceConnectionState(IceConnectionState iceConnectionState)
 {
-    m_iceConnectionState = iceConnectionState;
-    scheduleDispatchEvent(Event::create(eventNames().icechangeEvent, false, false));
+    if (m_iceConnectionState != IceConnectionStateClosed && m_iceConnectionState != iceConnectionState) {
+        m_iceConnectionState = iceConnectionState;
+        scheduleDispatchEvent(Event::create(eventNames().icechangeEvent, false, false));
+    }
 }
 
 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtr<Event> event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to