| Index: Source/modules/mediastream/RTCPeerConnection.cpp
|
| diff --git a/Source/modules/mediastream/RTCPeerConnection.cpp b/Source/modules/mediastream/RTCPeerConnection.cpp
|
| index 6f92019d085ed41edd8f2581e086b7bd23ab7069..d1902e29e3876dc11771ec85497c0e15b80531c6 100644
|
| --- a/Source/modules/mediastream/RTCPeerConnection.cpp
|
| +++ b/Source/modules/mediastream/RTCPeerConnection.cpp
|
| @@ -63,7 +63,7 @@
|
|
|
| namespace WebCore {
|
|
|
| -PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Dictionary& configuration, ExceptionState& es)
|
| +PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Dictionary& configuration, ExceptionState& exceptionState)
|
| {
|
| if (configuration.isUndefinedOrNull())
|
| return 0;
|
| @@ -71,14 +71,14 @@ PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction
|
| ArrayValue iceServers;
|
| bool ok = configuration.get("iceServers", iceServers);
|
| if (!ok || iceServers.isUndefinedOrNull()) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return 0;
|
| }
|
|
|
| size_t numberOfServers;
|
| ok = iceServers.length(numberOfServers);
|
| if (!ok) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return 0;
|
| }
|
|
|
| @@ -88,19 +88,19 @@ PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction
|
| Dictionary iceServer;
|
| ok = iceServers.get(i, iceServer);
|
| if (!ok) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return 0;
|
| }
|
|
|
| String urlString, username, credential;
|
| ok = iceServer.get("url", urlString);
|
| if (!ok) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return 0;
|
| }
|
| KURL url(KURL(), urlString);
|
| if (!url.isValid() || !(url.protocolIs("turn") || url.protocolIs("turns") || url.protocolIs("stun"))) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return 0;
|
| }
|
|
|
| @@ -113,25 +113,25 @@ PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction
|
| return rtcConfiguration.release();
|
| }
|
|
|
| -PassRefPtr<RTCPeerConnection> RTCPeerConnection::create(ExecutionContext* context, const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& es)
|
| +PassRefPtr<RTCPeerConnection> RTCPeerConnection::create(ExecutionContext* context, const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
|
| {
|
| - RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, es);
|
| - if (es.hadException())
|
| + RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, exceptionState);
|
| + if (exceptionState.hadException())
|
| return 0;
|
|
|
| - RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, es);
|
| - if (es.hadException())
|
| + RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, exceptionState);
|
| + if (exceptionState.hadException())
|
| return 0;
|
|
|
| - RefPtr<RTCPeerConnection> peerConnection = adoptRef(new RTCPeerConnection(context, configuration.release(), constraints.release(), es));
|
| + RefPtr<RTCPeerConnection> peerConnection = adoptRef(new RTCPeerConnection(context, configuration.release(), constraints.release(), exceptionState));
|
| peerConnection->suspendIfNeeded();
|
| - if (es.hadException())
|
| + if (exceptionState.hadException())
|
| return 0;
|
|
|
| return peerConnection.release();
|
| }
|
|
|
| -RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints, ExceptionState& es)
|
| +RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints, ExceptionState& exceptionState)
|
| : ActiveDOMObject(context)
|
| , m_signalingState(SignalingStateStable)
|
| , m_iceGatheringState(IceGatheringStateNew)
|
| @@ -143,20 +143,20 @@ RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCCo
|
| Document* document = toDocument(executionContext());
|
|
|
| if (!document->frame()) {
|
| - es.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| return;
|
| }
|
|
|
| m_peerHandler = RTCPeerConnectionHandler::create(this);
|
| if (!m_peerHandler) {
|
| - es.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| return;
|
| }
|
|
|
| document->frame()->loader().client()->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get());
|
|
|
| if (!m_peerHandler->initialize(configuration, constraints)) {
|
| - es.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| return;
|
| }
|
| }
|
| @@ -166,56 +166,56 @@ RTCPeerConnection::~RTCPeerConnection()
|
| stop();
|
| }
|
|
|
| -void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& mediaConstraints, ExceptionState& es)
|
| +void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!successCallback) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| - RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, es);
|
| - if (es.hadException())
|
| + RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
|
|
| RefPtr<RTCSessionDescriptionRequestImpl> request = RTCSessionDescriptionRequestImpl::create(executionContext(), successCallback, errorCallback);
|
| m_peerHandler->createOffer(request.release(), constraints);
|
| }
|
|
|
| -void RTCPeerConnection::createAnswer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& mediaConstraints, ExceptionState& es)
|
| +void RTCPeerConnection::createAnswer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!successCallback) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| - RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, es);
|
| - if (es.hadException())
|
| + RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
|
|
| RefPtr<RTCSessionDescriptionRequestImpl> request = RTCSessionDescriptionRequestImpl::create(executionContext(), successCallback, errorCallback);
|
| m_peerHandler->createAnswer(request.release(), constraints.release());
|
| }
|
|
|
| -void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& es)
|
| +void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
|
| if (!sessionDescription) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| @@ -223,7 +223,7 @@ void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr
|
| m_peerHandler->setLocalDescription(request.release(), sessionDescription->webSessionDescription());
|
| }
|
|
|
| -PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionState& es)
|
| +PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionState& exceptionState)
|
| {
|
| blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescription();
|
| if (webSessionDescription.isNull())
|
| @@ -233,16 +233,16 @@ PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionS
|
| return sessionDescription.release();
|
| }
|
|
|
| -void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& es)
|
| +void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
|
| if (!sessionDescription) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| @@ -250,7 +250,7 @@ void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> p
|
| m_peerHandler->setRemoteDescription(request.release(), sessionDescription->webSessionDescription());
|
| }
|
|
|
| -PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionState& es)
|
| +PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionState& exceptionState)
|
| {
|
| blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescription();
|
| if (webSessionDescription.isNull())
|
| @@ -260,52 +260,52 @@ PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(Exception
|
| return desc.release();
|
| }
|
|
|
| -void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& es)
|
| +void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| - RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, es);
|
| - if (es.hadException())
|
| + RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
|
|
| - RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, es);
|
| - if (es.hadException())
|
| + RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
|
|
| bool valid = m_peerHandler->updateIce(configuration, constraints);
|
| if (!valid)
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| }
|
|
|
| -void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, ExceptionState& es)
|
| +void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!iceCandidate) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| bool valid = m_peerHandler->addIceCandidate(iceCandidate->webCandidate());
|
| if (!valid)
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| }
|
|
|
| -void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& es)
|
| +void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!iceCandidate || !successCallback || !errorCallback) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| @@ -313,7 +313,7 @@ void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassRefPt
|
|
|
| bool implemented = m_peerHandler->addIceCandidate(request.release(), iceCandidate->webCandidate());
|
| if (!implemented)
|
| - es.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| }
|
|
|
| String RTCPeerConnection::signalingState() const
|
| @@ -375,42 +375,42 @@ String RTCPeerConnection::iceConnectionState() const
|
| return String();
|
| }
|
|
|
| -void RTCPeerConnection::addStream(PassRefPtr<MediaStream> prpStream, const Dictionary& mediaConstraints, ExceptionState& es)
|
| +void RTCPeerConnection::addStream(PassRefPtr<MediaStream> prpStream, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| RefPtr<MediaStream> stream = prpStream;
|
| if (!stream) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| if (m_localStreams.contains(stream))
|
| return;
|
|
|
| - RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, es);
|
| - if (es.hadException())
|
| + RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
|
|
| m_localStreams.append(stream);
|
|
|
| bool valid = m_peerHandler->addStream(stream->descriptor(), constraints);
|
| if (!valid)
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| }
|
|
|
| -void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, ExceptionState& es)
|
| +void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!prpStream) {
|
| - es.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError);
|
| return;
|
| }
|
|
|
| @@ -457,10 +457,10 @@ void RTCPeerConnection::getStats(PassRefPtr<RTCStatsCallback> successCallback, P
|
| m_peerHandler->getStats(statsRequest.release());
|
| }
|
|
|
| -PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, const Dictionary& options, ExceptionState& es)
|
| +PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, const Dictionary& options, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return 0;
|
| }
|
|
|
| @@ -480,8 +480,8 @@ PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, co
|
| options.get("protocol", protocolString);
|
| init.protocol = protocolString;
|
|
|
| - RefPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), m_peerHandler.get(), label, init, es);
|
| - if (es.hadException())
|
| + RefPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), m_peerHandler.get(), label, init, exceptionState);
|
| + if (exceptionState.hadException())
|
| return 0;
|
| m_dataChannels.append(channel);
|
| return channel.release();
|
| @@ -496,35 +496,35 @@ bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId)
|
| return false;
|
| }
|
|
|
| -PassRefPtr<RTCDTMFSender> RTCPeerConnection::createDTMFSender(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState& es)
|
| +PassRefPtr<RTCDTMFSender> RTCPeerConnection::createDTMFSender(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return 0;
|
| }
|
|
|
| if (!prpTrack) {
|
| - es.throwUninformativeAndGenericTypeError();
|
| + exceptionState.throwUninformativeAndGenericTypeError();
|
| return 0;
|
| }
|
|
|
| RefPtr<MediaStreamTrack> track = prpTrack;
|
|
|
| if (!hasLocalStreamWithTrackId(track->id())) {
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return 0;
|
| }
|
|
|
| - RefPtr<RTCDTMFSender> dtmfSender = RTCDTMFSender::create(executionContext(), m_peerHandler.get(), track.release(), es);
|
| - if (es.hadException())
|
| + RefPtr<RTCDTMFSender> dtmfSender = RTCDTMFSender::create(executionContext(), m_peerHandler.get(), track.release(), exceptionState);
|
| + if (exceptionState.hadException())
|
| return 0;
|
| return dtmfSender.release();
|
| }
|
|
|
| -void RTCPeerConnection::close(ExceptionState& es)
|
| +void RTCPeerConnection::close(ExceptionState& exceptionState)
|
| {
|
| if (m_signalingState == SignalingStateClosed) {
|
| - es.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
|
|