Changeset 144808 in webkit


Ignore:
Timestamp:
Mar 5, 2013 1:15:53 PM (11 years ago)
Author:
tommyw@google.com
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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r144807 r144808  
     12013-03-05  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Allow local and remote descriptions to be accessed after close
     4        https://bugs.webkit.org/show_bug.cgi?id=111437
     5
     6        Reviewed by Adam Barth.
     7
     8        Expanding tests to check the new behaviour.
     9
     10        * fast/mediastream/RTCPeerConnection-localDescription-expected.txt:
     11        * fast/mediastream/RTCPeerConnection-localDescription.html:
     12        * fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt:
     13        * fast/mediastream/RTCPeerConnection-remoteDescription.html:
     14
    1152013-03-05  Eric Seidel  <eric@webkit.org>
    216
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt

    r127906 r144808  
    99PASS requestFailed was called.
    1010PASS pc.localDescription.type is "offer"
     11PASS pc.localDescription.sdp is "local"
     12PASS pc.localDescription.type is "offer"
     13PASS pc.localDescription.sdp is "local"
    1114PASS successfullyParsed is true
    1215
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html

    r127906 r144808  
    1414    testPassed('requestFailed was called.');
    1515
    16     shouldBe('pc.localDescription.type', '"offer"');
     16    shouldBeEqualToString('pc.localDescription.type', "offer");
     17    shouldBeEqualToString('pc.localDescription.sdp', "local");
     18    pc.close();
     19    shouldBeEqualToString('pc.localDescription.type', "offer");
     20    shouldBeEqualToString('pc.localDescription.sdp', "local");
     21
    1722    finishJSTest();
    1823}
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt

    r127906 r144808  
    99PASS requestFailed was called.
    1010PASS pc.remoteDescription.type is "answer"
     11PASS pc.remoteDescription.sdp is "remote"
     12PASS pc.remoteDescription.type is "answer"
     13PASS pc.remoteDescription.sdp is "remote"
    1114PASS successfullyParsed is true
    1215
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html

    r127906 r144808  
    1414    testPassed('requestFailed was called.');
    1515
    16     shouldBe('pc.remoteDescription.type', '"answer"');
     16    shouldBeEqualToString('pc.remoteDescription.type', "answer");
     17    shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
     18    pc.close();
     19    shouldBeEqualToString('pc.remoteDescription.type', "answer");
     20    shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
     21
    1722    finishJSTest();
    1823}
  • trunk/Source/WebCore/ChangeLog

    r144805 r144808  
     12013-03-05  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Allow local and remote descriptions to be accessed after close
     4        https://bugs.webkit.org/show_bug.cgi?id=111437
     5
     6        Reviewed by Adam Barth.
     7
     8        It's quite clear in the standard that the getters should still return the old value.
     9        Also overhauling the state setters a bit to check if the new state is different.
     10
     11        Existing tests expanded to cover patch.
     12
     13        * Modules/mediastream/RTCPeerConnection.cpp:
     14        (WebCore::RTCPeerConnection::localDescription):
     15        (WebCore::RTCPeerConnection::remoteDescription):
     16        (WebCore::RTCPeerConnection::changeSignalingState):
     17        (WebCore::RTCPeerConnection::changeIceGatheringState):
     18        (WebCore::RTCPeerConnection::changeIceConnectionState):
     19
    1202013-03-05  Charlie Reis  <creis@chromium.org>
    221
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r144748 r144808  
    226226PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionCode& ec)
    227227{
    228     if (m_signalingState == SignalingStateClosed) {
    229         ec = INVALID_STATE_ERR;
    230         return 0;
    231     }
    232 
    233228    RefPtr<RTCSessionDescriptionDescriptor> descriptor = m_peerHandler->localDescription();
    234229    if (!descriptor)
     
    258253PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionCode& ec)
    259254{
    260     if (m_signalingState == SignalingStateClosed) {
    261         ec = INVALID_STATE_ERR;
    262         return 0;
    263     }
    264 
    265255    RefPtr<RTCSessionDescriptionDescriptor> descriptor = m_peerHandler->remoteDescription();
    266256    if (!descriptor)
     
    632622void RTCPeerConnection::changeSignalingState(SignalingState signalingState)
    633623{
    634     ASSERT(m_signalingState != SignalingStateClosed);
    635     m_signalingState = signalingState;
    636     scheduleDispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
     624    if (m_signalingState != SignalingStateClosed && m_signalingState != signalingState) {
     625        m_signalingState = signalingState;
     626        scheduleDispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
     627    }
    637628}
    638629
    639630void RTCPeerConnection::changeIceGatheringState(IceGatheringState iceGatheringState)
    640631{
    641     m_iceGatheringState = iceGatheringState;
    642     scheduleDispatchEvent(Event::create(eventNames().gatheringchangeEvent, false, false));
     632    if (m_iceGatheringState != iceGatheringState) {
     633        m_iceGatheringState = iceGatheringState;
     634        scheduleDispatchEvent(Event::create(eventNames().gatheringchangeEvent, false, false));
     635    }
    643636}
    644637
    645638void RTCPeerConnection::changeIceConnectionState(IceConnectionState iceConnectionState)
    646639{
    647     m_iceConnectionState = iceConnectionState;
    648     scheduleDispatchEvent(Event::create(eventNames().icechangeEvent, false, false));
     640    if (m_iceConnectionState != IceConnectionStateClosed && m_iceConnectionState != iceConnectionState) {
     641        m_iceConnectionState = iceConnectionState;
     642        scheduleDispatchEvent(Event::create(eventNames().icechangeEvent, false, false));
     643    }
    649644}
    650645
Note: See TracChangeset for help on using the changeset viewer.