From c3767681a9f6d9af799c2116741df6f42df6f37a Mon Sep 17 00:00:00 2001 From: Matheus Marinho Date: Fri, 6 Oct 2023 23:04:36 -0300 Subject: [PATCH 01/12] Correct overzealous GMP checks --- toolkit/xre/nsEmbedFunctions.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index bcedaa7792..84cc3f6752 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -471,11 +471,9 @@ XRE_InitChildProcess(int aArgc, // Content processes need the XPCOM/chromium frankenventloop uiLoopType = MessageLoop::TYPE_MOZILLA_CHILD; break; -#ifdef MOZ_GMP case GeckoProcessType_GMPlugin: uiLoopType = MessageLoop::TYPE_DEFAULT; break; -#endif default: uiLoopType = MessageLoop::TYPE_UI; break; @@ -537,11 +535,13 @@ XRE_InitChildProcess(int aArgc, #endif break; -#ifdef MOZ_GMP case GeckoProcessType_GMPlugin: +#ifdef MOZ_GMP process = new gmp::GMPProcessChild(parentPID); - break; +#else + NS_RUNTIMEABORT("rebuild with Gecko Media Plugins enabled"); #endif + break; case GeckoProcessType_GPU: process = new gfx::GPUProcessImpl(parentPID); From 1ed778419f429a7b5fea79018bc78e4c8aa5aa37 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Thu, 5 Oct 2023 16:47:30 -0400 Subject: [PATCH 02/12] Issue #2332 - Refactor code that feeds video stream sink when it gets added https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 1 --- dom/media/MediaStreamGraph.cpp | 64 +++++++++++++++------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 1b9e4f6749..01652af803 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -2876,8 +2876,8 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed listener = aListener; @@ -2886,44 +2886,30 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefedmData->GetType() == MediaSegment::AUDIO; - isVideo = data->mData->GetType() == MediaSegment::VIDEO; + updateData = FindDataForTrack(aTrackID); + track = FindTrack(aTrackID); + if (track) { + isAudio = track->GetType() == MediaSegment::AUDIO; + isVideo = track->GetType() == MediaSegment::VIDEO; } - // The track might be removed from mUpdateTrack but still exist in - // mTracks. - auto streamTrack = FindTrack(aTrackID); - bool foundTrack = !!streamTrack; - if (foundTrack) { - MediaStreamVideoSink* videoSink = listener->AsMediaStreamVideoSink(); + MediaStreamVideoSink* videoSink = listener->AsMediaStreamVideoSink(); + if (track && isVideo && videoSink) { // Re-send missed VideoSegment to new added MediaStreamVideoSink. - if (streamTrack->GetType() == MediaSegment::VIDEO && videoSink) { - VideoSegment videoSegment; - if (mTracks.GetForgottenDuration() < streamTrack->GetSegment()->GetDuration()) { - videoSegment.AppendSlice(*streamTrack->GetSegment(), - mTracks.GetForgottenDuration(), - streamTrack->GetSegment()->GetDuration()); - } else { - VideoSegment* streamTrackSegment = static_cast(streamTrack->GetSegment()); - VideoChunk* lastChunk = streamTrackSegment->GetLastChunk(); - if (lastChunk) { - StreamTime startTime = streamTrackSegment->GetDuration() - lastChunk->GetDuration(); - videoSegment.AppendSlice(*streamTrackSegment, - startTime, - streamTrackSegment->GetDuration()); - } - } - if (found) { - videoSegment.AppendSlice(*data->mData, 0, data->mData->GetDuration()); - } - videoSink->SetCurrentFrames(videoSegment); + VideoSegment* trackSegment = static_cast(track->GetSegment()); + VideoSegment videoSegment; + if (mTracks.GetForgottenDuration() < trackSegment->GetDuration()) { + videoSegment.AppendSlice(*trackSegment, + mTracks.GetForgottenDuration(), + trackSegment->GetDuration()); } + if (updateData) { + videoSegment.AppendSlice(*updateData->mData, 0, updateData->mData->GetDuration()); + } + videoSink->SetCurrentFrames(videoSegment); } - if (found && (isAudio || isVideo)) { + if (track && (isAudio || isVideo)) { for (auto entry : mDirectTrackListeners) { if (entry.mListener == listener && (entry.mTrackID == TRACK_ANY || entry.mTrackID == aTrackID)) { @@ -2939,7 +2925,7 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefedmTrackID = aTrackID; } } - if (!found) { + if (!track) { STREAM_LOG(LogLevel::Warning, ("Couldn't find source track for direct track listener %p", listener.get())); listener->NotifyDirectListenerInstalled( @@ -2953,9 +2939,15 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefedNotifyDirectListenerInstalled( DirectMediaStreamTrackListener::InstallationResult::SUCCESS); + if (!updateData) { + // The track exists but the mUpdateTracks entry was removed. + // This means that the track has ended. + listener->NotifyEnded(); + } } void From 580a231706a8174aaf615d096610fe981187f281 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Thu, 5 Oct 2023 16:51:40 -0400 Subject: [PATCH 03/12] Issue #2332 - Use only one listener in MediaPipelineTransmit https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 3 --- .../src/mediapipeline/MediaPipeline.cpp | 118 ++++++------------ .../src/mediapipeline/MediaPipeline.h | 2 - .../webrtc/signaling/test/FakeMediaStreams.h | 3 +- 3 files changed, 39 insertions(+), 84 deletions(-) diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index ee8347a551..4d7b3cc18d 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -1205,7 +1205,7 @@ void MediaPipeline::PacketReceived(TransportLayer *layer, } class MediaPipelineTransmit::PipelineListener - : public DirectMediaStreamTrackListener + : public MediaStreamVideoSink { friend class MediaPipelineTransmit; public: @@ -1293,15 +1293,17 @@ public: void NotifyDirectListenerInstalled(InstallationResult aResult) override; void NotifyDirectListenerUninstalled() override; + // Implement MediaStreamVideoSink + void SetCurrentFrames(const VideoSegment& aSegment) override; + void ClearFrames() override {} + private: void UnsetTrackIdImpl() { MutexAutoLock lock(mMutex); track_id_ = track_id_external_ = TRACK_INVALID; } - void NewData(MediaStreamGraph* graph, - StreamTime offset, - const MediaSegment& media); + void NewData(const MediaSegment& media, TrackRate aRate = 0); RefPtr conduit_; RefPtr audio_processing_; @@ -1390,34 +1392,6 @@ protected: }; #endif -class MediaPipelineTransmit::PipelineVideoSink : - public MediaStreamVideoSink -{ -public: - explicit PipelineVideoSink(const RefPtr& conduit, - MediaPipelineTransmit::PipelineListener* listener) - : conduit_(conduit) - , pipelineListener_(listener) - { - } - - virtual void SetCurrentFrames(const VideoSegment& aSegment) override; - virtual void ClearFrames() override {} - -private: - ~PipelineVideoSink() { - // release conduit on mainthread. Must use forget()! - nsresult rv = NS_DispatchToMainThread(new - ConduitDeleteEvent(conduit_.forget())); - MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main"); - if (NS_FAILED(rv)) { - MOZ_CRASH(); - } - } - RefPtr conduit_; - MediaPipelineTransmit::PipelineListener* pipelineListener_; -}; - MediaPipelineTransmit::MediaPipelineTransmit( const std::string& pc, nsCOMPtr main_thread, @@ -1432,7 +1406,6 @@ MediaPipelineTransmit::MediaPipelineTransmit( MediaPipeline(pc, TRANSMIT, main_thread, sts_thread, track_id, level, conduit, rtp_transport, rtcp_transport, filter), listener_(new PipelineListener(conduit)), - video_sink_(new PipelineVideoSink(conduit, listener_)), domtrack_(domtrack) { if (!IsVideo()) { @@ -1490,10 +1463,6 @@ void MediaPipelineTransmit::AttachToTrack(const std::string& track_id) { domtrack_->AddDirectListener(listener_); domtrack_->AddListener(listener_); -#if !defined(MOZILLA_EXTERNAL_LINKAGE) - domtrack_->AddDirectListener(video_sink_); -#endif - #ifndef MOZILLA_INTERNAL_API // this enables the unit tests that can't fiddle with principals and the like listener_->SetEnabled(true); @@ -1542,7 +1511,6 @@ MediaPipelineTransmit::DetachMedia() if (domtrack_) { domtrack_->RemoveDirectListener(listener_); domtrack_->RemoveListener(listener_); - domtrack_->RemoveDirectListener(video_sink_); domtrack_ = nullptr; } // Let the listener be destroyed with the pipeline (or later). @@ -1747,7 +1715,14 @@ NotifyRealtimeTrackData(MediaStreamGraph* graph, this << ", offset=" << offset << ", duration=" << media.GetDuration()); - NewData(graph, offset, media); + if (media.GetType() == MediaSegment::VIDEO) { + // We have to call the upstream NotifyRealtimeTrackData and + // MediaStreamVideoSink will route them to SetCurrentFrames. + MediaStreamVideoSink::NotifyRealtimeTrackData(graph, offset, media); + return; + } + + NewData(media, graph->GraphRate()); } void MediaPipelineTransmit::PipelineListener:: @@ -1756,10 +1731,17 @@ NotifyQueuedChanges(MediaStreamGraph* graph, const MediaSegment& queued_media) { MOZ_MTLOG(ML_DEBUG, "MediaPipeline::NotifyQueuedChanges()"); - // ignore non-direct data if we're also getting direct data - if (!direct_connect_) { - NewData(graph, offset, queued_media); + if (queued_media.GetType() == MediaSegment::VIDEO) { + // We always get video from SetCurrentFrames(). + return; } + + if (direct_connect_) { + // ignore non-direct data if we're also getting direct data + return; + } + + NewData(queued_media, graph->GraphRate()); } void MediaPipelineTransmit::PipelineListener:: @@ -1778,9 +1760,7 @@ NotifyDirectListenerUninstalled() { } void MediaPipelineTransmit::PipelineListener:: -NewData(MediaStreamGraph* graph, - StreamTime offset, - const MediaSegment& media) { +NewData(const MediaSegment& media, TrackRate aRate /* = 0 */) { if (!active_) { MOZ_MTLOG(ML_DEBUG, "Discarding packets because transport not ready"); return; @@ -1798,49 +1778,27 @@ NewData(MediaStreamGraph* graph, // track type and it's destined for us // See bug 784517 if (media.GetType() == MediaSegment::AUDIO) { - AudioSegment* audio = const_cast( - static_cast(&media)); + MOZ_RELEASE_ASSERT(aRate > 0); - AudioSegment::ChunkIterator iter(*audio); - while(!iter.IsEnded()) { - TrackRate rate; -#ifdef USE_FAKE_MEDIA_STREAMS - rate = Fake_MediaStream::GraphRate(); -#else - rate = graph->GraphRate(); -#endif - audio_processing_->QueueAudioChunk(rate, *iter, enabled_); - iter.Next(); + AudioSegment* audio = const_cast(static_cast(&media)); + for(AudioSegment::ChunkIterator iter(*audio); !iter.IsEnded(); iter.Next()) { + audio_processing_->QueueAudioChunk(aRate, *iter, enabled_); } +#if !defined(MOZILLA_EXTERNAL_LINKAGE) } else { - // Ignore + VideoSegment* video = const_cast(static_cast(&media)); + VideoSegment::ChunkIterator iter(*video); + for(VideoSegment::ChunkIterator iter(*video); !iter.IsEnded(); iter.Next()) { + converter_->QueueVideoChunk(*iter, !enabled_); + } +#endif // MOZILLA_EXTERNAL_LINKAGE } } -void MediaPipelineTransmit::PipelineVideoSink:: +void MediaPipelineTransmit::PipelineListener:: SetCurrentFrames(const VideoSegment& aSegment) { - MOZ_ASSERT(pipelineListener_); - - if (!pipelineListener_->active_) { - MOZ_MTLOG(ML_DEBUG, "Discarding packets because transport not ready"); - return; - } - - if (conduit_->type() != MediaSessionConduit::VIDEO) { - // Ignore data of wrong kind in case we have a muxed stream - return; - } - -#if !defined(MOZILLA_EXTERNAL_LINKAGE) - VideoSegment* video = const_cast(&aSegment); - - VideoSegment::ChunkIterator iter(*video); - while(!iter.IsEnded()) { - pipelineListener_->converter_->QueueVideoChunk(*iter, !pipelineListener_->enabled_); - iter.Next(); - } -#endif + NewData(aSegment); } class TrackAddedCallback { diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h index 00333b789d..919c28f23b 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h @@ -345,7 +345,6 @@ public: // Separate classes to allow ref counting class PipelineListener; class VideoFrameFeeder; - class PipelineVideoSink; protected: ~MediaPipelineTransmit(); @@ -357,7 +356,6 @@ public: RefPtr feeder_; RefPtr converter_; #endif - RefPtr video_sink_; dom::MediaStreamTrack* domtrack_; }; diff --git a/media/webrtc/signaling/test/FakeMediaStreams.h b/media/webrtc/signaling/test/FakeMediaStreams.h index 117d269055..0325bb700b 100644 --- a/media/webrtc/signaling/test/FakeMediaStreams.h +++ b/media/webrtc/signaling/test/FakeMediaStreams.h @@ -70,6 +70,7 @@ public: gGraph = new MediaStreamGraph(); return gGraph; } + uint32_t GraphRate() { return 16000; } }; } @@ -186,8 +187,6 @@ class Fake_MediaStream { public: Fake_MediaStream () : mListeners(), mTrackListeners(), mMutex("Fake MediaStream") {} - static uint32_t GraphRate() { return 16000; } - void AddListener(Fake_MediaStreamListener *aListener) { mozilla::MutexAutoLock lock(mMutex); mListeners.insert(aListener); From a87f8cc7f7998ddce6a8bd48f3f1547da9fd8d15 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Thu, 5 Oct 2023 16:48:52 -0400 Subject: [PATCH 04/12] Issue #2332 - Use the same path for passing on missed data to video sink, as during normal operation https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 2 --- dom/media/MediaStreamGraph.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 01652af803..b1853508d6 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -2893,8 +2893,7 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefedGetType() == MediaSegment::VIDEO; } - MediaStreamVideoSink* videoSink = listener->AsMediaStreamVideoSink(); - if (track && isVideo && videoSink) { + if (track && isVideo && listener->AsMediaStreamVideoSink()) { // Re-send missed VideoSegment to new added MediaStreamVideoSink. VideoSegment* trackSegment = static_cast(track->GetSegment()); VideoSegment videoSegment; @@ -2906,7 +2905,7 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefedmData, 0, updateData->mData->GetDuration()); } - videoSink->SetCurrentFrames(videoSegment); + listener->NotifyRealtimeTrackData(Graph(), 0, videoSegment); } if (track && (isAudio || isVideo)) { From f2dbc4c6cee90af22228b3b5dfe02ff893b255f8 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:00:40 -0400 Subject: [PATCH 05/12] Issue #2332 - Add deprecation warnings to writable RTCSessionDescription Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1313966 --- dom/media/PeerConnection.js | 60 +++++++++++++++++++------ dom/webidl/RTCSessionDescription.webidl | 9 ++-- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 622b1f08be..f735e371c1 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -38,6 +38,16 @@ const PC_RECEIVER_CID = Components.ID("{d974b814-8fde-411c-8c45-b86791b81030}"); const PC_COREQUEST_CID = Components.ID("{74b2122d-65a8-4824-aa9e-3d664cb75dc2}"); const PC_DTMF_SENDER_CID = Components.ID("{3610C242-654E-11E6-8EC0-6D1BE389A607}"); +function logMsg(msg, file, line, flag, winID) { + let scriptErrorClass = Cc["@mozilla.org/scripterror;1"]; + let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError); + scriptError.initWithWindowID(msg, file, null, line, 0, flag, + "content javascript", winID); + let console = Cc["@mozilla.org/consoleservice;1"]. + getService(Ci.nsIConsoleService); + console.logMessage(scriptError); +}; + // Global list of PeerConnection objects, so they can be cleaned up when // a page is torn down. (Maps inner window ID to an array of PC objects). function GlobalPCList() { @@ -236,9 +246,7 @@ RTCIceCandidate.prototype = { } }; -function RTCSessionDescription() { - this.type = this.sdp = null; -} +function RTCSessionDescription() {} RTCSessionDescription.prototype = { classDescription: "RTCSessionDescription", classID: PC_SESSION_CID, @@ -246,11 +254,41 @@ RTCSessionDescription.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIDOMGlobalPropertyInitializer]), - init: function(win) { this._win = win; }, + init: function(win) { + this._win = win; + this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID; + }, - __init: function(dict) { - this.type = dict.type; - this.sdp = dict.sdp; + __init: function({ type, sdp }) { + Object.assign(this, { _type: type, _sdp: sdp }); + }, + + get type() { return this._type; }, + set type(type) { + this.warn(); + this._type = type; + }, + + get sdp() { return this._sdp; }, + set sdp(sdp) { + this.warn(); + this._sdp = sdp; + }, + + warn: function() { + if (!this._warned) { + // Warn once per RTCSessionDescription about deprecated writable usage. + this.logWarning("RTCSessionDescription's members are readonly! " + + "Writing to them is deprecated and will break soon!"); + this._warned = true; + } + }, + + logWarning: function(msg) { + let err = this._win.Error(); + logMsg(msg, err.fileName, err.lineNumber, Ci.nsIScriptError.warningFlag, + this._winID); } }; @@ -645,13 +683,7 @@ RTCPeerConnection.prototype = { }, logMsg: function(msg, file, line, flag) { - let scriptErrorClass = Cc["@mozilla.org/scripterror;1"]; - let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError); - scriptError.initWithWindowID(msg, file, null, line, 0, flag, - "content javascript", this._winID); - let console = Cc["@mozilla.org/consoleservice;1"]. - getService(Ci.nsIConsoleService); - console.logMessage(scriptError); + return logMsg(msg, file, line, flag, this._winID); }, getEH: function(type) { diff --git a/dom/webidl/RTCSessionDescription.webidl b/dom/webidl/RTCSessionDescription.webidl index 07bfb36f02..4dafe01e1b 100644 --- a/dom/webidl/RTCSessionDescription.webidl +++ b/dom/webidl/RTCSessionDescription.webidl @@ -15,16 +15,17 @@ enum RTCSdpType { }; dictionary RTCSessionDescriptionInit { - RTCSdpType? type = null; - DOMString? sdp = ""; + required RTCSdpType type; + DOMString sdp = ""; }; [Pref="media.peerconnection.enabled", JSImplementation="@mozilla.org/dom/rtcsessiondescription;1", Constructor(optional RTCSessionDescriptionInit descriptionInitDict)] interface RTCSessionDescription { - attribute RTCSdpType? type; - attribute DOMString? sdp; + // These should be readonly, but writing causes deprecation warnings for a bit + attribute RTCSdpType type; + attribute DOMString sdp; jsonifier; }; From ddf29677d918140de113a81b8cd824b4aebefd02 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:02:11 -0400 Subject: [PATCH 06/12] Issue #2332 - Update RTCIceCandidate to spec Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 - part 1 --- dom/media/PeerConnection.js | 8 ++------ dom/webidl/RTCIceCandidate.webidl | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index f735e371c1..991cf5798f 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -227,9 +227,7 @@ GlobalPCList.prototype = { }; var _globalPCList = new GlobalPCList(); -function RTCIceCandidate() { - this.candidate = this.sdpMid = this.sdpMLineIndex = null; -} +function RTCIceCandidate() {} RTCIceCandidate.prototype = { classDescription: "RTCIceCandidate", classID: PC_ICE_CID, @@ -240,9 +238,7 @@ RTCIceCandidate.prototype = { init: function(win) { this._win = win; }, __init: function(dict) { - this.candidate = dict.candidate; - this.sdpMid = dict.sdpMid; - this.sdpMLineIndex = ("sdpMLineIndex" in dict)? dict.sdpMLineIndex : null; + Object.assign(this, dict); } }; diff --git a/dom/webidl/RTCIceCandidate.webidl b/dom/webidl/RTCIceCandidate.webidl index 67d479aef2..35b404bb7d 100644 --- a/dom/webidl/RTCIceCandidate.webidl +++ b/dom/webidl/RTCIceCandidate.webidl @@ -8,16 +8,16 @@ */ dictionary RTCIceCandidateInit { - DOMString? candidate = null; + required DOMString candidate; DOMString? sdpMid = null; - unsigned short sdpMLineIndex; + unsigned short? sdpMLineIndex = null; }; [Pref="media.peerconnection.enabled", JSImplementation="@mozilla.org/dom/rtcicecandidate;1", - Constructor(optional RTCIceCandidateInit candidateInitDict)] + Constructor(RTCIceCandidateInit candidateInitDict)] interface RTCIceCandidate { - attribute DOMString? candidate; + attribute DOMString candidate; attribute DOMString? sdpMid; attribute unsigned short? sdpMLineIndex; From 80a3c49ba2144e0d82a2ee00dcc918e99f551534 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:04:07 -0400 Subject: [PATCH 07/12] Issue #2332 - Have addIceCandidate take a dictionary Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 2 --- dom/media/PeerConnection.js | 11 ++++--- .../test_peerConnection_addIceCandidate.html | 29 ++++++++++--------- dom/webidl/RTCPeerConnection.webidl | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 991cf5798f..712c2b0d13 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -985,12 +985,15 @@ RTCPeerConnection.prototype = { containsTrickle(topSection) || sections.every(containsTrickle); }, - addIceCandidate: function(c, onSuccess, onError) { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => { - if (!c.candidate && !c.sdpMLineIndex) { - throw new this._win.DOMException("Invalid candidate passed to addIceCandidate!", - "InvalidParameterError"); + if (!c) { + // TODO: Implement processing for end-of-candidates (bug 1318167) + return Promise.resolve(); + } + if (c.sdpMid === null && c.sdpMLineIndex === null) { + throw new this._win.DOMException("Invalid candidate (both sdpMid and sdpMLineIndex are null).", + "TypeError"); } return this._chain(() => new this._win.Promise((resolve, reject) => { this._onAddIceCandidateSuccess = resolve; diff --git a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html index 93cbdd0832..a46af2d2f0 100644 --- a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html +++ b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html @@ -54,15 +54,15 @@ } ); }, - function PC_REMOTE_ADD_CANDIDATE_MISSING_INDEX(test) { - // Note: it is probably not a good idea to automatically fill a missing - // MLineIndex with a default value of zero, see bug 1157034 + function PC_REMOTE_ADD_MISSING_MID_AND_MISSING_INDEX(test) { var broken = new RTCIceCandidate( {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host"}); return test.pcRemote._pc.addIceCandidate(broken) .then( - // FIXME this needs to be updated once bug 1157034 is fixed - todo(false, "Missing index in got automatically set to a valid value bz://1157034") + generateErrorCallback("addIceCandidate should have failed."), + err => { + is(err.name, "TypeError", "Error is TypeError"); + } ); }, function PC_REMOTE_ADD_VALID_CANDIDATE(test) { @@ -70,7 +70,7 @@ {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", sdpMLineIndex: 0}); return test.pcRemote._pc.addIceCandidate(candidate) - .then(ok(true, "Successfully added valid ICE candidate")); + .then(() => ok(true, "Successfully added valid ICE candidate")); }, // bug 1095793 function PC_REMOTE_ADD_MISMATCHED_MID_AND_LEVEL_CANDIDATE(test) { @@ -79,12 +79,15 @@ sdpMLineIndex: 0, sdpMid: "sdparta_1"}); return test.pcRemote._pc.addIceCandidate(bogus) - .then( - generateErrorCallback("addIceCandidate should have failed."), - err => { - is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError"); - } - ); + .then(generateErrorCallback("addIceCandidate should have failed."), + err => is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError")); + }, + function PC_REMOTE_ADD_MID_AND_MISSING_INDEX(test) { + var candidate = new RTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMid: "sdparta_0"}); + return test.pcRemote._pc.addIceCandidate(candidate) + .then(() => ok(true, "Successfully added valid ICE candidate")); }, function PC_REMOTE_ADD_MATCHING_MID_AND_LEVEL_CANDIDATE(test) { var candidate = new mozRTCIceCandidate( @@ -92,7 +95,7 @@ sdpMLineIndex: 0, sdpMid: "sdparta_0"}); return test.pcRemote._pc.addIceCandidate(candidate) - .then(ok(true, "Successfully added valid ICE candidate with matching mid and level")); + .then(() => ok(true, "Successfully added valid ICE candidate with matching mid and level")); } ]); test.run(); diff --git a/dom/webidl/RTCPeerConnection.webidl b/dom/webidl/RTCPeerConnection.webidl index b852d32070..272d9c6c4e 100644 --- a/dom/webidl/RTCPeerConnection.webidl +++ b/dom/webidl/RTCPeerConnection.webidl @@ -91,7 +91,7 @@ interface RTCPeerConnection : EventTarget { readonly attribute RTCSessionDescription? localDescription; readonly attribute RTCSessionDescription? remoteDescription; readonly attribute RTCSignalingState signalingState; - Promise addIceCandidate (RTCIceCandidate candidate); + Promise addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate)? candidate); readonly attribute boolean? canTrickleIceCandidates; readonly attribute RTCIceGatheringState iceGatheringState; readonly attribute RTCIceConnectionState iceConnectionState; From 6b713575c9d71ef50ef5a7208b8ff2ba4d760dda Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:06:12 -0400 Subject: [PATCH 08/12] Issue #2332 - Have set(Local|Remote)Description take dictionaries Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 3 --- dom/webidl/RTCPeerConnection.webidl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dom/webidl/RTCPeerConnection.webidl b/dom/webidl/RTCPeerConnection.webidl index 272d9c6c4e..7e9016e0aa 100644 --- a/dom/webidl/RTCPeerConnection.webidl +++ b/dom/webidl/RTCPeerConnection.webidl @@ -7,7 +7,7 @@ * http://w3c.github.io/webrtc-pc/#interface-definition */ -callback RTCSessionDescriptionCallback = void (RTCSessionDescription sdp); +callback RTCSessionDescriptionCallback = void (RTCSessionDescriptionInit description); callback RTCPeerConnectionErrorCallback = void (DOMError error); callback RTCStatsCallback = void (RTCStatsReport report); @@ -84,10 +84,10 @@ interface RTCPeerConnection : EventTarget { optional DOMString username); [Pref="media.peerconnection.identity.enabled"] Promise getIdentityAssertion(); - Promise createOffer (optional RTCOfferOptions options); - Promise createAnswer (optional RTCAnswerOptions options); - Promise setLocalDescription (RTCSessionDescription description); - Promise setRemoteDescription (RTCSessionDescription description); + Promise createOffer (optional RTCOfferOptions options); + Promise createAnswer (optional RTCAnswerOptions options); + Promise setLocalDescription (RTCSessionDescriptionInit description); + Promise setRemoteDescription (RTCSessionDescriptionInit description); readonly attribute RTCSessionDescription? localDescription; readonly attribute RTCSessionDescription? remoteDescription; readonly attribute RTCSignalingState signalingState; @@ -155,10 +155,10 @@ partial interface RTCPeerConnection { optional RTCOfferOptions options); Promise createAnswer (RTCSessionDescriptionCallback successCallback, RTCPeerConnectionErrorCallback failureCallback); - Promise setLocalDescription (RTCSessionDescription description, + Promise setLocalDescription (RTCSessionDescriptionInit description, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback); - Promise setRemoteDescription (RTCSessionDescription description, + Promise setRemoteDescription (RTCSessionDescriptionInit description, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback); Promise addIceCandidate (RTCIceCandidate candidate, From a1c22cb03401a516ca4b396a905b3c140c597882 Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:07:05 -0400 Subject: [PATCH 09/12] Issue #2332 - Have createOffer/Answer resolve with dictionaries Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 4 --- dom/media/PeerConnection.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 712c2b0d13..e4612f8316 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -739,8 +739,7 @@ RTCPeerConnection.prototype = { this._impl.createOffer(options); })); p = this._addIdentityAssertion(p, origin); - return p.then( - sdp => new this._win.RTCSessionDescription({ type: "offer", sdp: sdp })); + return p.then(sdp => Cu.cloneInto({ type: "offer", sdp: sdp }, this._win)); }); }); }, @@ -774,9 +773,7 @@ RTCPeerConnection.prototype = { this._impl.createAnswer(); })); p = this._addIdentityAssertion(p, origin); - return p.then(sdp => { - return new this._win.RTCSessionDescription({ type: "answer", sdp: sdp }); - }); + return p.then(sdp => Cu.cloneInto({ type: "answer", sdp: sdp }, this._win)); }); }); }, @@ -1137,8 +1134,7 @@ RTCPeerConnection.prototype = { return null; } - return new this._win.RTCSessionDescription({ type: this._localType, - sdp: sdp }); + return new this._win.RTCSessionDescription({ type: this._localType, sdp }); }, get remoteDescription() { @@ -1147,8 +1143,7 @@ RTCPeerConnection.prototype = { if (sdp.length == 0) { return null; } - return new this._win.RTCSessionDescription({ type: this._remoteType, - sdp: sdp }); + return new this._win.RTCSessionDescription({ type: this._remoteType, sdp }); }, get peerIdentity() { return this._peerIdentity; }, From f615587ab7dcf33c0c2c9647a1f52cad1cb3e93b Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:08:07 -0400 Subject: [PATCH 10/12] Issue #2332 - Update most tests to skip RTCIceCandidate construction Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 5 --- dom/media/tests/mochitest/templates.js | 2 +- .../test_peerConnection_addIceCandidate.html | 14 +++++++------- .../test_peerConnection_closeDuringIce.html | 4 ++-- .../mochitest/test_peerConnection_iceFailure.html | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js index 3a8e0dd496..7a149c146e 100644 --- a/dom/media/tests/mochitest/templates.js +++ b/dom/media/tests/mochitest/templates.js @@ -118,7 +118,7 @@ var commandsPeerConnectionInitial = [ test.setupSignalingClient(); test.registerSignalingCallback("ice_candidate", function (message) { var pc = test.pcRemote ? test.pcRemote : test.pcLocal; - pc.storeOrAddIceCandidate(new RTCIceCandidate(message.ice_candidate)); + pc.storeOrAddIceCandidate(message.ice_candidate); }); test.registerSignalingCallback("end_of_trickle_ice", function (message) { test.signalingMessagesFinished(); diff --git a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html index a46af2d2f0..ba0039a513 100644 --- a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html +++ b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html @@ -19,9 +19,9 @@ test.chain.insertAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION", [ function PC_LOCAL_ADD_CANDIDATE_EARLY(test) { - var candidate = new RTCIceCandidate( - {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", - sdpMLineIndex: 0}); + var candidate = { + candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0}; return test.pcLocal._pc.addIceCandidate(candidate).then( generateErrorCallback("addIceCandidate should have failed."), err => { @@ -66,9 +66,9 @@ ); }, function PC_REMOTE_ADD_VALID_CANDIDATE(test) { - var candidate = new RTCIceCandidate( - {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", - sdpMLineIndex: 0}); + var candidate = { + candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0}; return test.pcRemote._pc.addIceCandidate(candidate) .then(() => ok(true, "Successfully added valid ICE candidate")); }, @@ -90,7 +90,7 @@ .then(() => ok(true, "Successfully added valid ICE candidate")); }, function PC_REMOTE_ADD_MATCHING_MID_AND_LEVEL_CANDIDATE(test) { - var candidate = new mozRTCIceCandidate( + var candidate = new RTCIceCandidate( {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", sdpMLineIndex: 0, sdpMid: "sdparta_0"}); diff --git a/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html b/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html index eb8228d03c..37b2011664 100644 --- a/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html +++ b/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html @@ -21,12 +21,12 @@ function PC_REMOTE_SETUP_NULL_ICE_HANDLER(test) { test.pcRemote.setupIceCandidateHandler(test, function() {}, function () {}); } function PC_REMOTE_ADD_FAKE_ICE_CANDIDATE(test) { - var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0}); + var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0}; test.pcRemote.storeOrAddIceCandidate(cand); info(test.pcRemote + " Stored fake candidate: " + JSON.stringify(cand)); } function PC_LOCAL_ADD_FAKE_ICE_CANDIDATE(test) { - var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0}); + var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0}; test.pcLocal.storeOrAddIceCandidate(cand); info(test.pcLocal + " Stored fake candidate: " + JSON.stringify(cand)); } diff --git a/dom/media/tests/mochitest/test_peerConnection_iceFailure.html b/dom/media/tests/mochitest/test_peerConnection_iceFailure.html index cbdfd018a0..3f6728573f 100644 --- a/dom/media/tests/mochitest/test_peerConnection_iceFailure.html +++ b/dom/media/tests/mochitest/test_peerConnection_iceFailure.html @@ -20,12 +20,12 @@ function PC_REMOTE_SETUP_NULL_ICE_HANDLER(test) { test.pcRemote.setupIceCandidateHandler(test, function() {}, function () {}); } function PC_REMOTE_ADD_FAKE_ICE_CANDIDATE(test) { - var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0}); + var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0}; test.pcRemote.storeOrAddIceCandidate(cand); info(test.pcRemote + " Stored fake candidate: " + JSON.stringify(cand)); } function PC_LOCAL_ADD_FAKE_ICE_CANDIDATE(test) { - var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0}); + var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0}; test.pcLocal.storeOrAddIceCandidate(cand); info(test.pcLocal + " Stored fake candidate: " + JSON.stringify(cand)); } From 763cdb00cbd47f42cdcd029115db92dedc278b6b Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 17:09:04 -0400 Subject: [PATCH 11/12] Issue #2332 - Update most tests to skip RTCSessionDescription construction Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 6 --- .../tests/mochitest/identity/test_fingerprints.html | 3 +-- dom/media/tests/mochitest/pc.js | 12 ++++++------ .../test_peerConnection_errorCallbacks.html | 6 ++---- .../test_peerConnection_localReofferRollback.html | 7 +++---- .../mochitest/test_peerConnection_localRollback.html | 7 +++---- .../test_peerConnection_remoteReofferRollback.html | 6 ++---- .../test_peerConnection_remoteRollback.html | 6 ++---- ...rConnection_restartIceLocalAndRemoteRollback.html | 6 ++---- .../test_peerConnection_restartIceLocalRollback.html | 8 +++----- 9 files changed, 24 insertions(+), 37 deletions(-) diff --git a/dom/media/tests/mochitest/identity/test_fingerprints.html b/dom/media/tests/mochitest/identity/test_fingerprints.html index 0fd065af26..bf26c2fdd5 100644 --- a/dom/media/tests/mochitest/identity/test_fingerprints.html +++ b/dom/media/tests/mochitest/identity/test_fingerprints.html @@ -86,8 +86,7 @@ function testMultipleFingerprints() { fingerprintSdp(fingerprints.slice(1)) + offer.sdp.slice(match.index); - var desc = new RTCSessionDescription({ type: 'offer', sdp: sdp }); - return pcStrict.setRemoteDescription(desc); + return pcStrict.setRemoteDescription({ type: 'offer', sdp }); }) .then(() => { ok(true, 'Modified fingerprints were accepted'); diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 2e9c7c63f1..4363841da7 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -334,7 +334,7 @@ PeerConnectionTest.prototype.createOffer = function(peer) { * * @param {PeerConnectionWrapper} peer The peer connection wrapper to run the command on - * @param {RTCSessionDescription} desc + * @param {RTCSessionDescriptionInit} desc * Session description for the local description request */ PeerConnectionTest.prototype.setLocalDescription = @@ -403,7 +403,7 @@ PeerConnectionTest.prototype.setOfferOptions = function(options) { * * @param {PeerConnectionWrapper} peer The peer connection wrapper to run the command on - * @param {RTCSessionDescription} desc + * @param {RTCSessionDescriptionInit} desc * Session description for the remote description request */ PeerConnectionTest.prototype.setRemoteDescription = @@ -1064,7 +1064,7 @@ PeerConnectionWrapper.prototype = { * Sets the local description and automatically handles the failure case. * * @param {object} desc - * RTCSessionDescription for the local description request + * RTCSessionDescriptionInit for the local description request */ setLocalDescription : function(desc) { this.observedNegotiationNeeded = undefined; @@ -1078,7 +1078,7 @@ PeerConnectionWrapper.prototype = { * causes the test case to fail if the call succeeds. * * @param {object} desc - * RTCSessionDescription for the local description request + * RTCSessionDescriptionInit for the local description request * @returns {Promise} * A promise that resolves to the expected error */ @@ -1095,7 +1095,7 @@ PeerConnectionWrapper.prototype = { * Sets the remote description and automatically handles the failure case. * * @param {object} desc - * RTCSessionDescription for the remote description request + * RTCSessionDescriptionInit for the remote description request */ setRemoteDescription : function(desc) { this.observedNegotiationNeeded = undefined; @@ -1115,7 +1115,7 @@ PeerConnectionWrapper.prototype = { * causes the test case to fail if the call succeeds. * * @param {object} desc - * RTCSessionDescription for the remote description request + * RTCSessionDescriptionInit for the remote description request * @returns {Promise} * a promise that resolve to the returned error */ diff --git a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html index 6d152a4fa6..9ae3b8d50f 100644 --- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html +++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html @@ -27,8 +27,7 @@ function testSetLocalDescriptionError() { var pc = new RTCPeerConnection(); info ("Testing setLocalDescription error"); - return pc.setLocalDescription(new RTCSessionDescription({ sdp: "Picklechips!", - type: "offer" })) + return pc.setLocalDescription({ sdp: "Picklechips!", type: "offer" }) .then(generateErrorCallback("setLocalDescription with nonsense SDP should fail"), validateReason); }; @@ -36,8 +35,7 @@ function testSetRemoteDescriptionError() { var pc = new RTCPeerConnection(); info ("Testing setRemoteDescription error"); - return pc.setRemoteDescription(new RTCSessionDescription({ sdp: "Who?", - type: "offer" })) + return pc.setRemoteDescription({ sdp: "Who?", type: "offer" }) .then(generateErrorCallback("setRemoteDescription with nonsense SDP should fail"), validateReason); }; diff --git a/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html b/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html index 0b0b35fe80..ed149747ca 100644 --- a/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html @@ -37,10 +37,9 @@ }, function PC_REMOTE_ROLLBACK(test) { - return test.setLocalDescription( - test.pcRemote, - new RTCSessionDescription({ type: "rollback", sdp: ""}), - STABLE); + return test.setLocalDescription(test.pcRemote, + { type: "rollback", sdp: "" }, + STABLE); }, // Rolling back should shut down gathering diff --git a/dom/media/tests/mochitest/test_peerConnection_localRollback.html b/dom/media/tests/mochitest/test_peerConnection_localRollback.html index 2a35920baa..45ceba844e 100644 --- a/dom/media/tests/mochitest/test_peerConnection_localRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_localRollback.html @@ -23,10 +23,9 @@ }, function PC_REMOTE_ROLLBACK(test) { - return test.setLocalDescription( - test.pcRemote, - new RTCSessionDescription({ type: "rollback", sdp: ""}), - STABLE); + return test.setLocalDescription(test.pcRemote, + { type: "rollback", sdp: "" }, + STABLE); }, // Rolling back should shut down gathering diff --git a/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html b/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html index 6b518e1d29..7580358b86 100644 --- a/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html @@ -35,10 +35,8 @@ }, function PC_REMOTE_ROLLBACK(test) { - return test.setRemoteDescription( - test.pcRemote, - new RTCSessionDescription({ type: "rollback" }), - STABLE) + return test.setRemoteDescription(test.pcRemote, { type: "rollback" }, + STABLE) .then(() => test.pcRemote.rollbackRemoteTracksIfNotNegotiated()); }, diff --git a/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html b/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html index 099628ab88..35a51d03c0 100644 --- a/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html @@ -20,10 +20,8 @@ function PC_REMOTE_ROLLBACK(test) { // We still haven't negotiated the tracks test.pcRemote.expectNegotiationNeeded(); - return test.setRemoteDescription( - test.pcRemote, - new RTCSessionDescription({ type: "rollback" }), - STABLE) + return test.setRemoteDescription(test.pcRemote, { type: "rollback" }, + STABLE) .then(() => test.pcRemote.rollbackRemoteTracksIfNotNegotiated()); }, diff --git a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html index e926171644..d2280cee87 100644 --- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html @@ -51,10 +51,8 @@ }, function PC_REMOTE_ROLLBACK(test) { - return test.setRemoteDescription( - test.pcRemote, - new RTCSessionDescription({ type: "rollback" }), - STABLE); + return test.setRemoteDescription(test.pcRemote, { type: "rollback" }, + STABLE); }, function PC_LOCAL_ROLLBACK(test) { diff --git a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html index c1ac186de1..fd9fee9c0c 100644 --- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html +++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html @@ -42,11 +42,9 @@ test.pcLocal.iceCheckingIceRollbackExpected = true; }, function PC_LOCAL_ROLLBACK(test) { - return test.setLocalDescription( - test.pcLocal, - new RTCSessionDescription({ type: "rollback", - sdp: ""}), - STABLE); + return test.setLocalDescription(test.pcLocal, + { type: "rollback", sdp: ""}, + STABLE); }, // Rolling back should shut down gathering function PC_LOCAL_WAIT_FOR_END_OF_TRICKLE(test) { From 348f761a9b7bb90f02dd10bac1aa8059f824a83a Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Mon, 9 Oct 2023 22:13:50 -0400 Subject: [PATCH 12/12] Issue #2332 - Fix CamerasChild helper to return by value instead of out-of-scope reference Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1318132 --- dom/media/systemservices/CamerasChild.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index abbcc9e223..341c6e17a7 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -223,7 +223,7 @@ public: Dispatch(); } - const T& ReturnValue() const { + T ReturnValue() const { if (mSuccess) { return mSuccessValue; } else {