mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1434803. Properly propagate out errors from various PeerConnectionImpl methods. r=drno
PeerConnectionImpl defines two versions of various fallible methods: a version taking an ErrorResult argument, and a version returning nsresult. The methods were not marked fallible in the webidl, so the bindings called the nsresult-returning version, but ignored the returned value. As a result, failures got swallowed instead of being propagated out. The changes here annotate the relevant parts of the webidl as throwing, and convert non-fallible methods to returning void to make infallibility clearer. MozReview-Commit-ID: JU9NzmEf8FV
This commit is contained in:
parent
478687c2e8
commit
31dfca239b
@ -53,6 +53,7 @@ interface PeerConnectionImpl {
|
||||
optional unsigned long interToneGap = 70);
|
||||
[Throws]
|
||||
DOMString getDTMFToneBuffer(RTCRtpSender sender);
|
||||
[Throws]
|
||||
sequence<RTCRtpSourceEntry> getRtpSources(MediaStreamTrack track,
|
||||
DOMHighResTimeStamp rtpSourceNow);
|
||||
DOMHighResTimeStamp getNowInRtpSourceReferenceTime();
|
||||
@ -63,20 +64,25 @@ interface PeerConnectionImpl {
|
||||
[Throws]
|
||||
void closeStreams();
|
||||
|
||||
[Throws]
|
||||
void addRIDExtension(MediaStreamTrack recvTrack, unsigned short extensionId);
|
||||
[Throws]
|
||||
void addRIDFilter(MediaStreamTrack recvTrack, DOMString rid);
|
||||
|
||||
// Inserts CSRC data for the RtpSourceObserver for testing
|
||||
[Throws]
|
||||
void insertAudioLevelForContributingSource(MediaStreamTrack recvTrack,
|
||||
unsigned long source,
|
||||
DOMHighResTimeStamp timestamp,
|
||||
boolean hasLevel,
|
||||
byte level);
|
||||
|
||||
[Throws]
|
||||
void enablePacketDump(unsigned long level,
|
||||
mozPacketDumpType type,
|
||||
boolean sending);
|
||||
|
||||
[Throws]
|
||||
void disablePacketDump(unsigned long level,
|
||||
mozPacketDumpType type,
|
||||
boolean sending);
|
||||
@ -90,6 +96,7 @@ interface PeerConnectionImpl {
|
||||
void addIceCandidate(DOMString candidate, DOMString mid, unsigned short level);
|
||||
|
||||
/* Puts the SIPCC engine back to 'kIdle', shuts down threads, deletes state */
|
||||
[Throws]
|
||||
void close();
|
||||
|
||||
/* Notify DOM window if this plugin crash is ours. */
|
||||
@ -115,6 +122,7 @@ interface PeerConnectionImpl {
|
||||
readonly attribute PCImplSignalingState signalingState;
|
||||
attribute DOMString id;
|
||||
|
||||
[SetterThrows]
|
||||
attribute DOMString peerIdentity;
|
||||
readonly attribute boolean privacyRequested;
|
||||
|
||||
|
@ -2084,7 +2084,7 @@ PeerConnectionImpl::CloseStreams() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_IMETHODIMP
|
||||
PeerConnectionImpl::SetPeerIdentity(const nsAString& aPeerIdentity)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL(true);
|
||||
@ -2577,7 +2577,7 @@ PeerConnectionImpl::GetFingerprint(char** fingerprint)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetLocalDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
@ -2585,33 +2585,27 @@ PeerConnectionImpl::GetLocalDescription(nsAString& aSDP)
|
||||
std::string localSdp = mJsepSession->GetLocalDescription(
|
||||
kJsepDescriptionPendingOrCurrent);
|
||||
aSDP = NS_ConvertASCIItoUTF16(localSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetCurrentLocalDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
||||
std::string localSdp = mJsepSession->GetLocalDescription(kJsepDescriptionCurrent);
|
||||
aSDP = NS_ConvertASCIItoUTF16(localSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetPendingLocalDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
||||
std::string localSdp = mJsepSession->GetLocalDescription(kJsepDescriptionPending);
|
||||
aSDP = NS_ConvertASCIItoUTF16(localSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetRemoteDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
@ -2619,30 +2613,24 @@ PeerConnectionImpl::GetRemoteDescription(nsAString& aSDP)
|
||||
std::string remoteSdp = mJsepSession->GetRemoteDescription(
|
||||
kJsepDescriptionPendingOrCurrent);
|
||||
aSDP = NS_ConvertASCIItoUTF16(remoteSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetCurrentRemoteDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
||||
std::string remoteSdp = mJsepSession->GetRemoteDescription(kJsepDescriptionCurrent);
|
||||
aSDP = NS_ConvertASCIItoUTF16(remoteSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PeerConnectionImpl::GetPendingRemoteDescription(nsAString& aSDP)
|
||||
{
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
||||
std::string remoteSdp = mJsepSession->GetRemoteDescription(kJsepDescriptionPending);
|
||||
aSDP = NS_ConvertASCIItoUTF16(remoteSdp.c_str());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -510,35 +510,35 @@ public:
|
||||
rv = DisablePacketDump(level, type, sending);
|
||||
}
|
||||
|
||||
nsresult GetPeerIdentity(nsAString& peerIdentity)
|
||||
void GetPeerIdentity(nsAString& peerIdentity)
|
||||
{
|
||||
if (mPeerIdentity) {
|
||||
peerIdentity = mPeerIdentity->ToString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
peerIdentity.SetIsVoid(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const PeerIdentity* GetPeerIdentity() const { return mPeerIdentity; }
|
||||
nsresult SetPeerIdentity(const nsAString& peerIdentity);
|
||||
NS_IMETHODIMP_TO_ERRORRESULT(SetPeerIdentity, ErrorResult& rv,
|
||||
const nsAString& peerIdentity)
|
||||
{
|
||||
rv = SetPeerIdentity(peerIdentity);
|
||||
}
|
||||
|
||||
const std::string& GetIdAsAscii() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
nsresult GetId(nsAString& id)
|
||||
void GetId(nsAString& id)
|
||||
{
|
||||
id = NS_ConvertASCIItoUTF16(mName.c_str());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetId(const nsAString& id)
|
||||
void SetId(const nsAString& id)
|
||||
{
|
||||
mName = NS_ConvertUTF16toUTF8(id).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// this method checks to see if we've made a promise to protect media.
|
||||
@ -553,13 +553,13 @@ public:
|
||||
delete[] tmp;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetLocalDescription(nsAString& aSDP);
|
||||
NS_IMETHODIMP GetCurrentLocalDescription(nsAString& aSDP);
|
||||
NS_IMETHODIMP GetPendingLocalDescription(nsAString& aSDP);
|
||||
void GetLocalDescription(nsAString& aSDP);
|
||||
void GetCurrentLocalDescription(nsAString& aSDP);
|
||||
void GetPendingLocalDescription(nsAString& aSDP);
|
||||
|
||||
NS_IMETHODIMP GetRemoteDescription(nsAString& aSDP);
|
||||
NS_IMETHODIMP GetCurrentRemoteDescription(nsAString& aSDP);
|
||||
NS_IMETHODIMP GetPendingRemoteDescription(nsAString& aSDP);
|
||||
void GetRemoteDescription(nsAString& aSDP);
|
||||
void GetCurrentRemoteDescription(nsAString& aSDP);
|
||||
void GetPendingRemoteDescription(nsAString& aSDP);
|
||||
|
||||
NS_IMETHODIMP SignalingState(mozilla::dom::PCImplSignalingState* aState);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user