Backed out 2 changesets (bug 1251714, bug 1251715) for gtest failures in media code a=backout
authorWes Kocher <wkocher@mozilla.com>
Tue, 01 Mar 2016 11:36:35 -0800
changeset 322637 71fabdbb3567e3d16836fac9daf84f9e6eaf5543
parent 322636 c5f11d429e6b03db7b7db5b860eb8f1cddf3ae3a
child 322638 eb25b90a05c194bfd4f498ff3ffee7440f85f1cd
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1251714, 1251715
milestone47.0a1
backs out1bbd0cd10f766916115b5d68d388bc3fe78b2b4c
80b197c5608fd6a5217078d444ce76b9e5938889
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1251714, bug 1251715) for gtest failures in media code a=backout Backed out changeset 1bbd0cd10f76 (bug 1251714) Backed out changeset 80b197c5608f (bug 1251715) MozReview-Commit-ID: EHOtiKLS4Xr
dom/media/MediaManager.cpp
dom/media/MediaManager.h
dom/media/VideoSegment.cpp
dom/media/systemservices/MediaChild.cpp
dom/media/systemservices/MediaUtils.h
media/mtransport/nricectx.h
media/mtransport/nricemediastream.cpp
media/mtransport/nricemediastream.h
media/mtransport/test/buffered_stun_socket_unittest.cpp
media/mtransport/test/ice_unittest.cpp
media/mtransport/test/multi_tcp_socket_unittest.cpp
media/mtransport/test/proxy_tunnel_socket_unittest.cpp
media/mtransport/test/stunserver.cpp
media/mtransport/test/stunserver.h
media/mtransport/test/turn_unittest.cpp
media/mtransport/transportflow.cpp
media/mtransport/transportflow.h
media/mtransport/transportlayerdtls.cpp
media/mtransport/transportlayerdtls.h
media/mtransport/transportlayerice.h
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/test/mediaconduit_unittests.cpp
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1098,17 +1098,17 @@ GetSources(MediaEngine *engine, MediaSou
 
 static auto& MediaManager_GetInstance = MediaManager::GetInstance;
 static auto& MediaManager_ToJSArray = MediaManager::ToJSArray;
 static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices;
 
 already_AddRefed<MediaManager::PledgeChar>
 MediaManager::SelectSettings(
     MediaStreamConstraints& aConstraints,
-    RefPtr<Refcountable<UniquePtr<SourceSet>>>& aSources)
+    RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>>& aSources)
 {
   MOZ_ASSERT(NS_IsMainThread());
   RefPtr<PledgeChar> p = new PledgeChar();
   uint32_t id = mOutstandingCharPledges.Append(*p);
 
   // Algorithm accesses device capabilities code and must run on media thread.
   // Modifies passed-in aSources.
 
@@ -1409,17 +1409,17 @@ MediaManager::EnumerateRawDevices(uint64
     if (fakeCams || fakeMics) {
       fakeBackend = new MediaEngineDefault(aFakeTracks);
     }
     if ((!fakeCams && hasVideo) || (!fakeMics && hasAudio)) {
       RefPtr<MediaManager> manager = MediaManager_GetInstance();
       realBackend = manager->GetBackend(aWindowId);
     }
 
-    auto result = MakeUnique<SourceSet>();
+    ScopedDeletePtr<SourceSet> result(new SourceSet);
 
     if (hasVideo) {
       nsTArray<RefPtr<VideoDevice>> videos;
       GetSources(fakeCams? fakeBackend : realBackend, aVideoType,
                  &MediaEngine::EnumerateVideoDevices, videos, videoLoopDev);
       for (auto& source : videos) {
         result->AppendElement(source);
       }
@@ -1427,26 +1427,26 @@ MediaManager::EnumerateRawDevices(uint64
     if (hasAudio) {
       nsTArray<RefPtr<AudioDevice>> audios;
       GetSources(fakeMics? fakeBackend : realBackend, aAudioType,
                  &MediaEngine::EnumerateAudioDevices, audios, audioLoopDev);
       for (auto& source : audios) {
         result->AppendElement(source);
       }
     }
-    SourceSet* handoff = result.release();
+    SourceSet* handoff = result.forget();
     NS_DispatchToMainThread(do_AddRef(NewRunnableFrom([id, handoff]() mutable {
-      UniquePtr<SourceSet> result(handoff); // grab result
+      ScopedDeletePtr<SourceSet> result(handoff); // grab result
       RefPtr<MediaManager> mgr = MediaManager_GetInstance();
       if (!mgr) {
         return NS_OK;
       }
       RefPtr<PledgeSourceSet> p = mgr->mOutstandingPledges.Remove(id);
       if (p) {
-        p->Resolve(result.release());
+        p->Resolve(result.forget());
       }
       return NS_OK;
     })));
   }));
   return p.forget();
 }
 
 MediaManager::MediaManager()
@@ -1604,19 +1604,19 @@ MediaManager::GetInstance()
   RefPtr<MediaManager> service = MediaManager::Get();
   return service.forget();
 }
 
 media::Parent<media::NonE10s>*
 MediaManager::GetNonE10sParent()
 {
   if (!mNonE10sParent) {
-    mNonE10sParent = MakeUnique<media::Parent<media::NonE10s>>(true);
+    mNonE10sParent = new media::Parent<media::NonE10s>(true);
   }
-  return mNonE10sParent.get();
+  return mNonE10sParent;
 }
 
 /* static */ void
 MediaManager::StartupInit()
 {
 #ifdef WIN32
   if (IsVistaOrLater() && !IsWin8OrLater()) {
     // Bug 1107702 - Older Windows fail in GetAdaptersInfo (and others) if the
@@ -2110,18 +2110,18 @@ MediaManager::GetUserMedia(nsPIDOMWindow
       (!fake || Preferences::GetBool("media.navigator.permission.fake"));
 
   RefPtr<PledgeSourceSet> p = EnumerateDevicesImpl(windowID, videoType,
                                                    audioType, fake,
                                                    fakeTracks);
   p->Then([this, onSuccess, onFailure, windowID, c, listener, askPermission,
            prefs, isHTTPS, callID, origin](SourceSet*& aDevices) mutable {
 
-    RefPtr<Refcountable<UniquePtr<SourceSet>>> devices(
-         new Refcountable<UniquePtr<SourceSet>>(aDevices)); // grab result
+    RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>> devices(
+         new Refcountable<ScopedDeletePtr<SourceSet>>(aDevices)); // grab result
 
     // Ensure that the captured 'this' pointer and our windowID are still good.
     if (!MediaManager::Exists() ||
         !nsGlobalWindow::GetInnerWindowWithId(windowID)) {
       return;
     }
 
     // Apply any constraints. This modifies the passed-in list.
@@ -2171,17 +2171,17 @@ MediaManager::GetUserMedia(nsPIDOMWindow
         }
       }
 
       // Pass callbacks and MediaStreamListener along to GetUserMediaTask.
       nsAutoPtr<GetUserMediaTask> task (new GetUserMediaTask(c, onSuccess.forget(),
                                                              onFailure.forget(),
                                                              windowID, listener,
                                                              prefs, origin,
-                                                             devices->release()));
+                                                             devices->forget()));
       // Store the task w/callbacks.
       mActiveCallbacks.Put(callID, task.forget());
 
       // Add a WindowID cross-reference so OnNavigation can tear things down
       nsTArray<nsString>* array;
       if (!mCallIds.Get(windowID, &array)) {
         array = new nsTArray<nsString>();
         mCallIds.Put(windowID, array);
@@ -2330,29 +2330,29 @@ MediaManager::EnumerateDevicesImpl(uint6
            aFake, aFakeTracks](const nsCString& aOriginKey) mutable {
     MOZ_ASSERT(NS_IsMainThread());
     RefPtr<MediaManager> mgr = MediaManager_GetInstance();
 
     RefPtr<PledgeSourceSet> p = mgr->EnumerateRawDevices(aWindowId,
                                                          aVideoType, aAudioType,
                                                          aFake, aFakeTracks);
     p->Then([id, aWindowId, aOriginKey](SourceSet*& aDevices) mutable {
-      UniquePtr<SourceSet> devices(aDevices); // secondary result
+      ScopedDeletePtr<SourceSet> devices(aDevices); // secondary result
 
       // Only run if window is still on our active list.
       RefPtr<MediaManager> mgr = MediaManager_GetInstance();
       if (!mgr) {
         return NS_OK;
       }
       RefPtr<PledgeSourceSet> p = mgr->mOutstandingPledges.Remove(id);
       if (!p || !mgr->IsWindowStillActive(aWindowId)) {
         return NS_OK;
       }
       MediaManager_AnonymizeDevices(*devices, aOriginKey);
-      p->Resolve(devices.release());
+      p->Resolve(devices.forget());
       return NS_OK;
     });
   });
   return pledge.forget();
 }
 
 nsresult
 MediaManager::EnumerateDevices(nsPIDOMWindowInner* aWindow,
@@ -2376,17 +2376,17 @@ MediaManager::EnumerateDevices(nsPIDOMWi
 
   bool fake = Preferences::GetBool("media.navigator.streams.fake");
 
   RefPtr<PledgeSourceSet> p = EnumerateDevicesImpl(windowId,
                                                      MediaSourceEnum::Camera,
                                                      MediaSourceEnum::Microphone,
                                                      fake);
   p->Then([onSuccess, windowId, listener](SourceSet*& aDevices) mutable {
-    UniquePtr<SourceSet> devices(aDevices); // grab result
+    ScopedDeletePtr<SourceSet> devices(aDevices); // grab result
     RefPtr<MediaManager> mgr = MediaManager_GetInstance();
     mgr->RemoveFromWindowList(windowId, listener);
     nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*devices);
     onSuccess->OnSuccess(array);
   }, [onFailure, windowId, listener](MediaStreamError*& reason) mutable {
     RefPtr<MediaManager> mgr = MediaManager_GetInstance();
     mgr->RemoveFromWindowList(windowId, listener);
     onFailure->OnError(reason);
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -25,17 +25,16 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/dom/MediaStreamBinding.h"
 #include "mozilla/dom/MediaStreamTrackBinding.h"
 #include "mozilla/dom/MediaStreamError.h"
 #include "mozilla/media/MediaChild.h"
 #include "mozilla/media/MediaParent.h"
 #include "mozilla/Logging.h"
-#include "mozilla/UniquePtr.h"
 #include "DOMMediaStream.h"
 
 #ifdef MOZ_WEBRTC
 #include "mtransport/runnable_utils.h"
 #endif
 
 // Note, these suck in Windows headers, unfortunately.
 #include "base/thread.h"
@@ -497,17 +496,17 @@ private:
   already_AddRefed<PledgeSourceSet>
   EnumerateDevicesImpl(uint64_t aWindowId,
                        dom::MediaSourceEnum aVideoSrcType,
                        dom::MediaSourceEnum aAudioSrcType,
                        bool aFake = false, bool aFakeTracks = false);
   already_AddRefed<PledgeChar>
   SelectSettings(
       dom::MediaStreamConstraints& aConstraints,
-      RefPtr<media::Refcountable<UniquePtr<SourceSet>>>& aSources);
+      RefPtr<media::Refcountable<ScopedDeletePtr<SourceSet>>>& aSources);
 
   StreamListeners* AddWindowID(uint64_t aWindowId);
   WindowTable *GetActiveWindows() {
     MOZ_ASSERT(NS_IsMainThread());
     return &mActiveWindows;
   }
 
   void GetPref(nsIPrefBranch *aBranch, const char *aPref,
@@ -546,14 +545,14 @@ private:
   media::CoatCheck<PledgeSourceSet> mOutstandingPledges;
   media::CoatCheck<PledgeChar> mOutstandingCharPledges;
   media::CoatCheck<GetUserMediaCallbackMediaStreamListener::PledgeVoid> mOutstandingVoidPledges;
 #if defined(MOZ_B2G_CAMERA) && defined(MOZ_WIDGET_GONK)
   RefPtr<nsDOMCameraManager> mCameraManager;
 #endif
 public:
   media::CoatCheck<media::Pledge<nsCString>> mGetOriginKeyPledges;
-  UniquePtr<media::Parent<media::NonE10s>> mNonE10sParent;
+  ScopedDeletePtr<media::Parent<media::NonE10s>> mNonE10sParent;
 };
 
 } // namespace mozilla
 
 #endif // MOZILLA_MEDIAMANAGER_H
--- a/dom/media/VideoSegment.cpp
+++ b/dom/media/VideoSegment.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "VideoSegment.h"
 
 #include "gfx2DGlue.h"
 #include "ImageContainer.h"
 #include "Layers.h"
-#include "mozilla/UniquePtr.h"
 
 namespace mozilla {
 
 using namespace layers;
 
 VideoFrame::VideoFrame(already_AddRefed<Image>& aImage,
                        const gfx::IntSize& aIntrinsicSize)
   : mImage(aImage), mIntrinsicSize(aIntrinsicSize), mForceBlack(false)
@@ -48,28 +47,28 @@ VideoFrame::CreateBlackImage(const gfx::
   if (!image) {
     MOZ_ASSERT(false);
     return nullptr;
   }
 
   int len = ((aSize.width * aSize.height) * 3 / 2);
 
   // Generate a black image.
-  auto frame = MakeUnique<uint8_t[]>(len);
+  ScopedDeletePtr<uint8_t> frame(new uint8_t[len]);
   int y = aSize.width * aSize.height;
   // Fill Y plane.
-  memset(frame.get(), 0x10, y);
+  memset(frame.rwget(), 0x10, y);
   // Fill Cb/Cr planes.
-  memset(frame.get() + y, 0x80, (len - y));
+  memset(frame.rwget() + y, 0x80, (len - y));
 
   const uint8_t lumaBpp = 8;
   const uint8_t chromaBpp = 4;
 
   layers::PlanarYCbCrData data;
-  data.mYChannel = frame.get();
+  data.mYChannel = frame.rwget();
   data.mYSize = gfx::IntSize(aSize.width, aSize.height);
   data.mYStride = (int32_t) (aSize.width * lumaBpp / 8.0);
   data.mCbCrStride = (int32_t) (aSize.width * chromaBpp / 8.0);
   data.mCbChannel = frame.get() + aSize.height * data.mYStride;
   data.mCrChannel = data.mCbChannel + aSize.height * data.mCbCrStride / 2;
   data.mCbCrSize = gfx::IntSize(aSize.width / 2, aSize.height / 2);
   data.mPicX = 0;
   data.mPicY = 0;
--- a/dom/media/systemservices/MediaChild.cpp
+++ b/dom/media/systemservices/MediaChild.cpp
@@ -41,17 +41,17 @@ void
 SanitizeOriginKeys(const uint64_t& aSinceWhen, bool aOnlyPrivateBrowsing)
 {
   LOG(("SanitizeOriginKeys since %llu %s", aSinceWhen,
        (aOnlyPrivateBrowsing? "in Private Browsing." : ".")));
 
   if (XRE_GetProcessType() == GeckoProcessType_Default) {
     // Avoid opening MediaManager in this case, since this is called by
     // sanitize.js when cookies are cleared, which can happen on startup.
-    auto tmpParent = MakeUnique<Parent<NonE10s>>(true);
+    ScopedDeletePtr<Parent<NonE10s>> tmpParent(new Parent<NonE10s>(true));
     tmpParent->RecvSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);
   } else {
     Child::Get()->SendSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);
   }
 }
 
 static Child* sChild;
 
--- a/dom/media/systemservices/MediaUtils.h
+++ b/dom/media/systemservices/MediaUtils.h
@@ -5,17 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_MediaUtils_h
 #define mozilla_MediaUtils_h
 
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
 #include "nsIAsyncShutdown.h"
-#include "mozilla/UniquePtr.h"
 #include "base/task.h"
 
 namespace mozilla {
 namespace media {
 
 /*
  * media::Pledge - A promise-like pattern for c++ that takes lambda functions.
  *
@@ -92,18 +91,18 @@ public:
       void Fail(ErrorType& error)
       {
         mOnFailure(error);
       };
 
       OnSuccessType mOnSuccess;
       OnFailureType mOnFailure;
     };
-    mFunctors = MakeUnique<Functors>(Forward<OnSuccessType>(aOnSuccess),
-                                     Forward<OnFailureType>(aOnFailure));
+    mFunctors = new Functors(Forward<OnSuccessType>(aOnSuccess),
+                             Forward<OnFailureType>(aOnFailure));
     if (mDone) {
       if (!mRejected) {
         mFunctors->Succeed(mValue);
       } else {
         mFunctors->Fail(mError);
       }
     }
   }
@@ -138,17 +137,17 @@ protected:
   }
 
   ValueType mValue;
 private:
   ~Pledge() {};
   bool mDone;
   bool mRejected;
   ErrorType mError;
-  UniquePtr<FunctorsBase> mFunctors;
+  ScopedDeletePtr<FunctorsBase> mFunctors;
 };
 
 /* media::NewRunnableFrom() - Create an nsRunnable from a lambda.
  * media::NewTaskFrom()     - Create a Task from a lambda.
  *
  * Passing variables (closures) to an async function is clunky with nsRunnable:
  *
  *   void Foo()
@@ -333,36 +332,36 @@ private:
  * algorithm on another thread may find it more expedient to modify a passed-in
  * object, rather than pass expensive copies back and forth.
  *
  * Lists in particular often aren't ref-countable, yet are expensive to copy,
  * e.g. nsTArray<RefPtr<Foo>>. Refcountable can be used to make such objects
  * (or owning smart-pointers to such objects) refcountable.
  *
  * Technical limitation: A template specialization is needed for types that take
- * a constructor. Please add below (UniquePtr covers a lot of ground though).
+ * a constructor. Please add below (ScopedDeletePtr covers a lot of ground though).
  */
 
 template<typename T>
 class Refcountable : public T
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Refcountable<T>)
 private:
   ~Refcountable<T>() {}
 };
 
 template<typename T>
-class Refcountable<UniquePtr<T>> : public UniquePtr<T>
+class Refcountable<ScopedDeletePtr<T>> : public ScopedDeletePtr<T>
 {
 public:
-  explicit Refcountable<UniquePtr<T>>(T* aPtr) : UniquePtr<T>(aPtr) {}
+  explicit Refcountable<ScopedDeletePtr<T>>(T* aPtr) : ScopedDeletePtr<T>(aPtr) {}
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Refcountable<T>)
 private:
-  ~Refcountable<UniquePtr<T>>() {}
+  ~Refcountable<ScopedDeletePtr<T>>() {}
 };
 
 /* media::ShutdownBlocker - Async shutdown helper.
  */
 
 class ShutdownBlocker : public nsIAsyncShutdownBlocker
 {
 public:
--- a/media/mtransport/nricectx.h
+++ b/media/mtransport/nricectx.h
@@ -53,18 +53,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 #include <string>
 #include <vector>
 
 #include "sigslot.h"
 
 #include "prnetdb.h"
 
 #include "mozilla/RefPtr.h"
+#include "mozilla/Scoped.h"
 #include "mozilla/TimeStamp.h"
-#include "mozilla/UniquePtr.h"
 #include "nsAutoPtr.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 
 #include "m_cpp_utils.h"
 
 typedef struct nr_ice_ctx_ nr_ice_ctx;
 typedef struct nr_ice_peer_ctx_ nr_ice_peer_ctx;
@@ -94,25 +94,26 @@ extern const char kNrIceTransportTcp[];
 
 class NrIceStunServer {
  public:
   explicit NrIceStunServer(const PRNetAddr& addr) : has_addr_(true) {
     memcpy(&addr_, &addr, sizeof(addr));
   }
 
    // The main function to use. Will take either an address or a hostname.
-  static UniquePtr<NrIceStunServer> Create(const std::string& addr, uint16_t port,
+  static NrIceStunServer* Create(const std::string& addr, uint16_t port,
       const char *transport = kNrIceTransportUdp) {
-    UniquePtr<NrIceStunServer> server(new NrIceStunServer(transport));
+    ScopedDeletePtr<NrIceStunServer> server(
+        new NrIceStunServer(transport));
 
     nsresult rv = server->Init(addr, port);
     if (NS_FAILED(rv))
       return nullptr;
 
-    return server;
+    return server.forget();
   }
 
   nsresult ToNicerStunStruct(nr_ice_stun_server* server) const;
 
  protected:
   explicit NrIceStunServer(const char *transport) :
       addr_(), transport_(transport) {}
 
@@ -140,27 +141,28 @@ class NrIceStunServer {
   std::string host_;
   uint16_t port_;
   PRNetAddr addr_;
   std::string transport_;
 };
 
 class NrIceTurnServer : public NrIceStunServer {
  public:
-  static UniquePtr<NrIceTurnServer> Create(const std::string& addr, uint16_t port,
-                                           const std::string& username,
-                                           const std::vector<unsigned char>& password,
-                                           const char *transport = kNrIceTransportUdp) {
-    UniquePtr<NrIceTurnServer> server(new NrIceTurnServer(username, password, transport));
+  static NrIceTurnServer *Create(const std::string& addr, uint16_t port,
+                                 const std::string& username,
+                                 const std::vector<unsigned char>& password,
+                                 const char *transport = kNrIceTransportUdp) {
+    ScopedDeletePtr<NrIceTurnServer> server(
+        new NrIceTurnServer(username, password, transport));
 
     nsresult rv = server->Init(addr, port);
     if (NS_FAILED(rv))
       return nullptr;
 
-    return server;
+    return server.forget();
   }
 
   nsresult ToNicerTurnStruct(nr_ice_turn_server *server) const;
 
  private:
   NrIceTurnServer(const std::string& username,
                   const std::vector<unsigned char>& password,
                   const char *transport) :
--- a/media/mtransport/nricemediastream.cpp
+++ b/media/mtransport/nricemediastream.cpp
@@ -41,16 +41,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 */
 
 
 #include <string>
 #include <vector>
 
 #include "logging.h"
 #include "nsError.h"
+#include "mozilla/Scoped.h"
 
 // nICEr includes
 extern "C" {
 #include "nr_api.h"
 #include "registry.h"
 #include "async_timer.h"
 #include "ice_util.h"
 #include "transport_addr.h"
@@ -163,23 +164,23 @@ static bool ToNrIceCandidate(const nr_ic
   out->tcp_type = tcp_type;
   out->codeword = candc.codeword;
   return true;
 }
 
 // Make an NrIceCandidate from the candidate |cand|.
 // This is not a member fxn because we want to hide the
 // defn of nr_ice_candidate but we pass by reference.
-static UniquePtr<NrIceCandidate> MakeNrIceCandidate(const nr_ice_candidate& candc) {
-  UniquePtr<NrIceCandidate> out(new NrIceCandidate());
+static NrIceCandidate* MakeNrIceCandidate(const nr_ice_candidate& candc) {
+  ScopedDeletePtr<NrIceCandidate> out(new NrIceCandidate());
 
-  if (!ToNrIceCandidate(candc, out.get())) {
+  if (!ToNrIceCandidate(candc, out)) {
     return nullptr;
   }
-  return out;
+  return out.forget();
 }
 
 // NrIceMediaStream
 RefPtr<NrIceMediaStream>
 NrIceMediaStream::Create(NrIceCtx *ctx,
                          const std::string& name,
                          int components) {
   RefPtr<NrIceMediaStream> stream =
@@ -253,18 +254,18 @@ nsresult NrIceMediaStream::ParseTrickleC
     }
   }
 
   return NS_OK;
 }
 
 // Returns NS_ERROR_NOT_AVAILABLE if component is unpaired or disabled.
 nsresult NrIceMediaStream::GetActivePair(int component,
-                                         UniquePtr<NrIceCandidate>* localp,
-                                         UniquePtr<NrIceCandidate>* remotep) {
+                                         NrIceCandidate **localp,
+                                         NrIceCandidate **remotep) {
   int r;
   nr_ice_candidate *local_int;
   nr_ice_candidate *remote_int;
 
   if (!stream_) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -274,30 +275,30 @@ nsresult NrIceMediaStream::GetActivePair
                                      &local_int, &remote_int);
   // If result is R_REJECTED then component is unpaired or disabled.
   if (r == R_REJECTED)
     return NS_ERROR_NOT_AVAILABLE;
 
   if (r)
     return NS_ERROR_FAILURE;
 
-  UniquePtr<NrIceCandidate> local(
+  ScopedDeletePtr<NrIceCandidate> local(
       MakeNrIceCandidate(*local_int));
   if (!local)
     return NS_ERROR_FAILURE;
 
-  UniquePtr<NrIceCandidate> remote(
+  ScopedDeletePtr<NrIceCandidate> remote(
       MakeNrIceCandidate(*remote_int));
   if (!remote)
     return NS_ERROR_FAILURE;
 
   if (localp)
-    *localp = Move(local);
+    *localp = local.forget();
   if (remotep)
-    *remotep = Move(remote);
+    *remotep = remote.forget();
 
   return NS_OK;
 }
 
 
 nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>*
                                              out_pairs) const {
   MOZ_ASSERT(out_pairs);
--- a/media/mtransport/nricemediastream.h
+++ b/media/mtransport/nricemediastream.h
@@ -45,17 +45,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 #define nricemediastream_h__
 
 #include <string>
 #include <vector>
 
 #include "sigslot.h"
 
 #include "mozilla/RefPtr.h"
-#include "mozilla/UniquePtr.h"
+#include "mozilla/Scoped.h"
 #include "nsCOMPtr.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 
 #include "m_cpp_utils.h"
 
 
 namespace mozilla {
@@ -154,18 +154,17 @@ class NrIceMediaStream {
   nsresult ParseTrickleCandidate(const std::string& candidate);
 
   // Disable a component
   nsresult DisableComponent(int component);
 
   // Get the candidate pair currently active. It's the
   // caller's responsibility to free these.
   nsresult GetActivePair(int component,
-                         UniquePtr<NrIceCandidate>* local,
-                         UniquePtr<NrIceCandidate>* remote);
+                         NrIceCandidate** local, NrIceCandidate** remote);
 
   // The number of components
   size_t components() const { return components_; }
 
   // The underlying nICEr stream
   nr_ice_media_stream *stream() { return stream_; }
   // Signals to indicate events. API users can (and should)
   // register for these.
--- a/media/mtransport/test/buffered_stun_socket_unittest.cpp
+++ b/media/mtransport/test/buffered_stun_socket_unittest.cpp
@@ -7,16 +7,18 @@
 // Original author: ekr@rtfm.com
 
 #include <iostream>
 
 #include "nspr.h"
 #include "nss.h"
 #include "ssl.h"
 
+#include "mozilla/Scoped.h"
+
 extern "C" {
 #include "nr_api.h"
 #include "nr_socket.h"
 #include "nr_socket_buffered_stun.h"
 #include "transport_addr.h"
 #include "stun.h"
 }
 
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -17,16 +17,17 @@
 #include "sigslot.h"
 
 #include "logging.h"
 #include "nspr.h"
 #include "nss.h"
 #include "ssl.h"
 
 #include "mozilla/Preferences.h"
+#include "mozilla/Scoped.h"
 #include "nsThreadUtils.h"
 #include "nsXPCOM.h"
 
 #include "nricectx.h"
 #include "nricemediastream.h"
 #include "nriceresolverfake.h"
 #include "nriceresolver.h"
 #include "nrinterfaceprioritizer.h"
@@ -465,17 +466,17 @@ class IceTestPeer : public sigslot::has_
   void SetStunServer(const std::string addr, uint16_t port,
                      const char* transport = kNrIceTransportUdp) {
     if (addr.empty()) {
       // Happens when MOZ_DISABLE_NONLOCAL_CONNECTIONS is set
       return;
     }
 
     std::vector<NrIceStunServer> stun_servers;
-    UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(
+    ScopedDeletePtr<NrIceStunServer> server(NrIceStunServer::Create(
         addr, port, transport));
     stun_servers.push_back(*server);
     SetStunServers(stun_servers);
   }
 
   void SetStunServers(const std::vector<NrIceStunServer> &servers) {
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetStunServers(servers)));
   }
@@ -494,17 +495,17 @@ class IceTestPeer : public sigslot::has_
   }
 
 
   void SetTurnServer(const std::string addr, uint16_t port,
                      const std::string username,
                      const std::vector<unsigned char> password,
                      const char* transport) {
     std::vector<NrIceTurnServer> turn_servers;
-    UniquePtr<NrIceTurnServer> server(NrIceTurnServer::Create(
+    ScopedDeletePtr<NrIceTurnServer> server(NrIceTurnServer::Create(
         addr, port, username, password, transport));
     turn_servers.push_back(*server);
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetTurnServers(turn_servers)));
   }
 
   void SetTurnServers(const std::vector<NrIceTurnServer> servers) {
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetTurnServers(servers)));
   }
@@ -838,18 +839,18 @@ class IceTestPeer : public sigslot::has_
     for (size_t i=0; i < streams_.size(); ++i) {
       if (!streams_[i]) {
         continue;
       }
 
       for (size_t j=0; j < streams_[i]->components(); ++j) {
         std::cerr << "Stream " << i << " component " << j+1 << std::endl;
 
-        UniquePtr<NrIceCandidate> local;
-        UniquePtr<NrIceCandidate> remote;
+        NrIceCandidate *local;
+        NrIceCandidate *remote;
 
         nsresult res = streams_[i]->GetActivePair(j+1, &local, &remote);
         if (res == NS_ERROR_NOT_AVAILABLE) {
           std::cerr << "Component unpaired or disabled." << std::endl;
         } else {
           ASSERT_TRUE(NS_SUCCEEDED(res));
           DumpCandidate("Local  ", *local);
           /* Depending on timing, and the whims of the network
@@ -870,16 +871,18 @@ class IceTestPeer : public sigslot::has_
             ASSERT_NE(NrIceCandidate::ICE_SERVER_REFLEXIVE, remote->type);
             ASSERT_NE(NrIceCandidate::ICE_RELAYED, remote->type);
           } else {
             ASSERT_EQ(expected_remote_type_, remote->type);
           }
           if (!expected_remote_addr_.empty()) {
             ASSERT_EQ(expected_remote_addr_, remote->cand_addr.host);
           }
+          delete local;
+          delete remote;
         }
       }
     }
   }
 
   void DumpAndCheckActiveCandidates() {
     test_utils_->sts_target()->Dispatch(
       WrapRunnable(this, &IceTestPeer::DumpAndCheckActiveCandidates_s),
@@ -1307,22 +1310,22 @@ class IceGatherTest : public StunTest {
 
   void TearDown() override {
     peer_ = nullptr;
     StunTest::TearDown();
   }
 
   void EnsurePeer(const unsigned int flags = ICE_TEST_PEER_OFFERER) {
     if (!peer_) {
-      peer_ = MakeUnique<IceTestPeer>("P1", test_utils_,
-                                      flags & ICE_TEST_PEER_OFFERER,
-                                      flags & ICE_TEST_PEER_ALLOW_LOOPBACK,
-                                      flags & ICE_TEST_PEER_ENABLED_TCP,
-                                      flags & ICE_TEST_PEER_ALLOW_LINK_LOCAL,
-                                      flags & ICE_TEST_PEER_HIDE_NON_DEFAULT);
+      peer_ = new IceTestPeer("P1", test_utils_,
+                              flags & ICE_TEST_PEER_OFFERER,
+                              flags & ICE_TEST_PEER_ALLOW_LOOPBACK,
+                              flags & ICE_TEST_PEER_ENABLED_TCP,
+                              flags & ICE_TEST_PEER_ALLOW_LINK_LOCAL,
+                              flags & ICE_TEST_PEER_HIDE_NON_DEFAULT);
       peer_->AddStream(1);
     }
   }
 
   void Gather(unsigned int waitTime = kDefaultTimeout) {
     EnsurePeer();
     peer_->Gather();
 
@@ -1445,17 +1448,17 @@ class IceGatherTest : public StunTest {
               << candidates.size() << std::endl;
 
     for (auto c : candidates) {
       std::cerr << "Candidate: " << c << std::endl;
     }
   }
 
  protected:
-  mozilla::UniquePtr<IceTestPeer> peer_;
+  mozilla::ScopedDeletePtr<IceTestPeer> peer_;
 };
 
 class IceConnectTest : public StunTest {
  public:
   IceConnectTest() :
     initted_(false),
     use_nat_(false),
     filtering_type_(TestNat::ENDPOINT_INDEPENDENT),
@@ -1485,20 +1488,20 @@ class IceConnectTest : public StunTest {
 
   void RemoveStream(size_t index) {
     p1_->RemoveStream(index);
     p2_->RemoveStream(index);
   }
 
   void Init(bool allow_loopback, bool enable_tcp, bool default_only = false) {
     if (!initted_) {
-      p1_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, allow_loopback,
-                                    enable_tcp, false, default_only);
-      p2_ = MakeUnique<IceTestPeer>("P2", test_utils_, false, allow_loopback,
-                                    enable_tcp, false, default_only);
+      p1_ = new IceTestPeer("P1", test_utils_, true, allow_loopback,
+                            enable_tcp, false, default_only);
+      p2_ = new IceTestPeer("P2", test_utils_, false, allow_loopback,
+                            enable_tcp, false, default_only);
     }
     initted_ = true;
   }
 
   bool Gather(unsigned int waitTime = kDefaultTimeout,
               bool setupStunServers = true) {
     Init(false, false);
     if (use_nat_) {
@@ -1585,18 +1588,18 @@ class IceConnectTest : public StunTest {
     }
   }
 
   void Connect() {
     // IceTestPeer::Connect grabs attributes from the first arg, and gives them
     // to |this|, meaning that p2_->Connect(p1_, ...) simulates p1 sending an
     // offer to p2. Order matters here because it determines which peer is
     // controlling.
-    p2_->Connect(p1_.get(), TRICKLE_NONE);
-    p1_->Connect(p2_.get(), TRICKLE_NONE);
+    p2_->Connect(p1_, TRICKLE_NONE);
+    p1_->Connect(p2_, TRICKLE_NONE);
 
     ASSERT_TRUE_WAIT(p1_->ready_ct() == 1 && p2_->ready_ct() == 1,
                      kDefaultTimeout);
     ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(),
                      kDefaultTimeout);
     AssertCheckingReached();
 
     p1_->DumpAndCheckActiveCandidates();
@@ -1616,21 +1619,21 @@ class IceConnectTest : public StunTest {
   }
 
   void SetExpectedRemoteCandidateAddr(const std::string& addr) {
     p1_->SetExpectedRemoteCandidateAddr(addr);
     p2_->SetExpectedRemoteCandidateAddr(addr);
   }
 
   void ConnectP1(TrickleMode mode = TRICKLE_NONE) {
-    p1_->Connect(p2_.get(), mode);
+    p1_->Connect(p2_, mode);
   }
 
   void ConnectP2(TrickleMode mode = TRICKLE_NONE) {
-    p2_->Connect(p1_.get(), mode);
+    p2_->Connect(p1_, mode);
   }
 
   void WaitForComplete(int expected_streams = 1) {
     ASSERT_TRUE_WAIT(p1_->ready_ct() == expected_streams &&
                      p2_->ready_ct() == expected_streams, kDefaultTimeout);
     ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(),
                      kDefaultTimeout);
   }
@@ -1641,18 +1644,18 @@ class IceConnectTest : public StunTest {
   }
 
   void WaitForGather() {
     ASSERT_TRUE_WAIT(p1_->gathering_complete(), kDefaultTimeout);
     ASSERT_TRUE_WAIT(p2_->gathering_complete(), kDefaultTimeout);
   }
 
   void ConnectTrickle(TrickleMode trickle = TRICKLE_SIMULATE) {
-    p2_->Connect(p1_.get(), trickle);
-    p1_->Connect(p2_.get(), trickle);
+    p2_->Connect(p1_, trickle);
+    p1_->Connect(p2_, trickle);
   }
 
   void SimulateTrickle(size_t stream) {
     p1_->SimulateTrickle(stream);
     p2_->SimulateTrickle(stream);
     ASSERT_TRUE_WAIT(p1_->is_ready(stream), kDefaultTimeout);
     ASSERT_TRUE_WAIT(p2_->is_ready(stream), kDefaultTimeout);
   }
@@ -1668,18 +1671,18 @@ class IceConnectTest : public StunTest {
   void VerifyConnected() {
   }
 
   void CloseP1() {
     p1_->Close();
   }
 
   void ConnectThenDelete() {
-    p2_->Connect(p1_.get(), TRICKLE_NONE, false);
-    p1_->Connect(p2_.get(), TRICKLE_NONE, true);
+    p2_->Connect(p1_, TRICKLE_NONE, false);
+    p1_->Connect(p2_, TRICKLE_NONE, true);
     test_utils_->sts_target()->Dispatch(WrapRunnable(this,
                                                     &IceConnectTest::CloseP1),
                                        NS_DISPATCH_SYNC);
     p2_->StartChecks();
 
     // Wait to see if we crash
     PR_Sleep(PR_MillisecondsToInterval(kDefaultTimeout));
   }
@@ -1693,18 +1696,18 @@ class IceConnectTest : public StunTest {
         NS_DISPATCH_SYNC);
     ASSERT_EQ(1u, p1_->sent());
     ASSERT_TRUE_WAIT(p2_->received() == 1, 1000);
   }
 
  protected:
   bool initted_;
   nsCOMPtr<nsIEventTarget> target_;
-  mozilla::UniquePtr<IceTestPeer> p1_;
-  mozilla::UniquePtr<IceTestPeer> p2_;
+  mozilla::ScopedDeletePtr<IceTestPeer> p1_;
+  mozilla::ScopedDeletePtr<IceTestPeer> p2_;
   bool use_nat_;
   TestNat::NatBehavior filtering_type_;
   TestNat::NatBehavior mapping_type_;
   bool block_udp_;
 };
 
 class PrioritizerTest : public StunTest {
  public:
@@ -1852,17 +1855,17 @@ TEST_F(IceGatherTest, TestGatherFakeStun
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherStunServerIpAddressDefaultRouteOnly) {
   if (stun_server_address_.empty()) {
     return;
   }
 
-  peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
+  peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
   peer_->AddStream(1);
   peer_->SetStunServer(stun_server_address_, kDefaultStunServerPort);
   peer_->SetFakeResolver(stun_server_address_, stun_server_hostname_);
   Gather();
   ASSERT_FALSE(StreamHasMatchingCandidate(0, " host "));
 }
 
 TEST_F(IceGatherTest, TestGatherFakeStunServerHostname) {
@@ -2041,25 +2044,25 @@ TEST_F(IceGatherTest, TestGatherDisableC
 
 TEST_F(IceGatherTest, TestGatherVerifyNoLoopback) {
   Gather();
   ASSERT_FALSE(StreamHasMatchingCandidate(0, "127.0.0.1"));
 }
 
 TEST_F(IceGatherTest, TestGatherAllowLoopback) {
   // Set up peer with loopback allowed.
-  peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, true);
+  peer_ = new IceTestPeer("P1", test_utils_, true, true);
   peer_->AddStream(1);
   Gather();
   ASSERT_TRUE(StreamHasMatchingCandidate(0, "127.0.0.1"));
 }
 
 TEST_F(IceGatherTest, TestGatherTcpDisabled) {
   // Set up peer with tcp disabled.
-  peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false);
+  peer_ = new IceTestPeer("P1", test_utils_, true, false, false);
   peer_->AddStream(1);
   Gather();
   ASSERT_FALSE(StreamHasMatchingCandidate(0, " TCP "));
   ASSERT_TRUE(StreamHasMatchingCandidate(0, " UDP "));
 }
 
 // Verify that a bogus candidate doesn't cause crashes on the
 // main thread. See bug 856433.
@@ -2152,17 +2155,17 @@ TEST_F(IceGatherTest, TestStunServerTric
   ASSERT_FALSE(StreamHasMatchingCandidate(0, "192.0.2.1"));
   WaitForGather();
   ASSERT_TRUE(StreamHasMatchingCandidate(0, "192.0.2.1"));
 }
 
 // Test default route only with our fake STUN server and
 // apparently NATted.
 TEST_F(IceGatherTest, TestFakeStunServerNatedDefaultRouteOnly) {
-  peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
+  peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
   peer_->AddStream(1);
   UseFakeStunUdpServerWithResponse("192.0.2.1", 3333);
   Gather(0);
   WaitForGather();
   DumpCandidates(0);
   ASSERT_FALSE(StreamHasMatchingCandidate(0, "host"));
   ASSERT_TRUE(StreamHasMatchingCandidate(0, "srflx"));
   NrIceCandidate default_candidate;
@@ -2170,17 +2173,17 @@ TEST_F(IceGatherTest, TestFakeStunServer
   if (NS_SUCCEEDED(rv)) {
     ASSERT_NE(NrIceCandidate::ICE_HOST, default_candidate.type);
   }
 }
 
 // Test default route only with our fake STUN server and
 // apparently non-NATted.
 TEST_F(IceGatherTest, TestFakeStunServerNoNatDefaultRouteOnly) {
-  peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
+  peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
   peer_->AddStream(1);
   UseTestStunServer();
   Gather(0);
   WaitForGather();
   DumpCandidates(0);
   ASSERT_FALSE(StreamHasMatchingCandidate(0, "host"));
   ASSERT_TRUE(StreamHasMatchingCandidate(0, "srflx"));
 }
@@ -3049,18 +3052,20 @@ TEST_F(IceConnectTest, TestHostCandPairi
 
   int host_net = p1_->GetCandidatesPrivateIpv4Range(0);
   if (host_net <= 0) {
     // TODO bug 1226838: make this work with multiple private IPs
     FAIL() << "This test needs exactly one private IPv4 host candidate to work" << std::endl;
   }
 
   ConnectTrickle();
-  AddNonPairableCandidates(p1_->ControlTrickle(0), p1_.get(), 0, host_net, test_utils_);
-  AddNonPairableCandidates(p2_->ControlTrickle(0), p2_.get(), 0, host_net, test_utils_);
+  AddNonPairableCandidates(p1_->ControlTrickle(0), p1_, 0, host_net,
+                           test_utils_);
+  AddNonPairableCandidates(p2_->ControlTrickle(0), p2_, 0, host_net,
+                           test_utils_);
 
   std::vector<NrIceCandidatePair> pairs;
   p1_->GetCandidatePairs(0, &pairs);
   for (auto p : pairs) {
     std::cerr << "Verifying pair:" << std::endl;
     p1_->DumpCandidatePair(p);
     nr_transport_addr addr;
     nr_str_port_to_transport_addr(p.local.local_addr.host.c_str(), 0, IPPROTO_UDP, &addr);
@@ -3111,18 +3116,18 @@ TEST_F(IceConnectTest, TestSrflxCandPair
     ASSERT_TRUE(nr_transport_addr_get_private_addr_range(&addr) == 0);
   }
 }
 
 TEST_F(IceConnectTest, TestPollCandPairsDuringConnect) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather());
 
-  p2_->Connect(p1_.get(), TRICKLE_NONE, false);
-  p1_->Connect(p2_.get(), TRICKLE_NONE, false);
+  p2_->Connect(p1_, TRICKLE_NONE, false);
+  p1_->Connect(p2_, TRICKLE_NONE, false);
 
   std::vector<NrIceCandidatePair> pairs1;
   std::vector<NrIceCandidatePair> pairs2;
 
   p1_->StartChecks();
   p1_->UpdateAndValidateCandidatePairs(0, &pairs1);
   p2_->UpdateAndValidateCandidatePairs(0, &pairs2);
 
@@ -3136,18 +3141,18 @@ TEST_F(IceConnectTest, TestPollCandPairs
   ASSERT_TRUE(ContainsSucceededPair(pairs1));
   ASSERT_TRUE(ContainsSucceededPair(pairs2));
 }
 
 TEST_F(IceConnectTest, TestRLogRingBuffer) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather());
 
-  p2_->Connect(p1_.get(), TRICKLE_NONE, false);
-  p1_->Connect(p2_.get(), TRICKLE_NONE, false);
+  p2_->Connect(p1_, TRICKLE_NONE, false);
+  p1_->Connect(p2_, TRICKLE_NONE, false);
 
   std::vector<NrIceCandidatePair> pairs1;
   std::vector<NrIceCandidatePair> pairs2;
 
   p1_->StartChecks();
   p1_->UpdateAndValidateCandidatePairs(0, &pairs1);
   p2_->UpdateAndValidateCandidatePairs(0, &pairs2);
 
--- a/media/mtransport/test/multi_tcp_socket_unittest.cpp
+++ b/media/mtransport/test/multi_tcp_socket_unittest.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <iostream>
 #include <vector>
 
+#include "mozilla/Scoped.h"
 #include "mozilla/Atomics.h"
 #include "runnable_utils.h"
 #include "nss.h"
 #include "pk11pub.h"
 
 extern "C" {
 #include "nr_api.h"
 #include "nr_socket.h"
@@ -100,17 +101,17 @@ class MultiTcpSocketTest : public Mtrans
                 uint16_t stun_server_port, nr_socket **sock) {
     nr_transport_addr local;
     // Get start of port range for test
     static unsigned short port_s = GetRandomPort();
     int r;
 
     if (!stun_server_addr.empty()) {
       std::vector<NrIceStunServer> stun_servers;
-      UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(
+      ScopedDeletePtr<NrIceStunServer> server(NrIceStunServer::Create(
           stun_server_addr, stun_server_port, kNrIceTransportTcp));
       stun_servers.push_back(*server);
 
       ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetStunServers(stun_servers)));
     }
 
     r = 1;
     for (int tries=10; tries && r; --tries) {
--- a/media/mtransport/test/proxy_tunnel_socket_unittest.cpp
+++ b/media/mtransport/test/proxy_tunnel_socket_unittest.cpp
@@ -7,16 +7,18 @@
 // Original authors: ekr@rtfm.com; ryan@tokbox.com
 
 #include <iostream>
 
 #include "nspr.h"
 #include "nss.h"
 #include "ssl.h"
 
+#include "mozilla/Scoped.h"
+
 extern "C" {
 #include "nr_api.h"
 #include "nr_socket.h"
 #include "nr_proxy_tunnel.h"
 #include "transport_addr.h"
 #include "stun.h"
 }
 
--- a/media/mtransport/test/stunserver.cpp
+++ b/media/mtransport/test/stunserver.cpp
@@ -73,18 +73,17 @@ nrappkit copyright:
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
 
 
    ekr@rtfm.com  Thu Dec 20 20:14:49 2001
 */
 #include "logging.h"
-#include "mozilla/UniquePtr.h"
-#include "mozilla/unused.h"
+#include "mozilla/Scoped.h"
 #include "databuffer.h"
 
 extern "C" {
 #include "nr_api.h"
 #include "async_wait.h"
 #include "async_timer.h"
 #include "nr_socket.h"
 #include "nr_socket_local.h"
@@ -170,36 +169,36 @@ static nr_socket_vtbl nr_socket_wrapped_
   0,
   0,
   nr_socket_wrapped_close,
   0,
   0
 };
 
 int nr_socket_wrapped_create(nr_socket *inner, nr_socket **outp) {
-  auto wrapped = MakeUnique<nr_socket_wrapped>();
+  ScopedDeletePtr<nr_socket_wrapped> wrapped(new nr_socket_wrapped());
 
   wrapped->sock_ = inner;
 
   int r = nr_socket_create_int(wrapped.get(), &nr_socket_wrapped_vtbl, outp);
   if (r)
     return r;
 
-  Unused << wrapped.release();
+  wrapped.forget();
   return 0;
 }
 
 
 // Instance static.
 // Note: Calling Create() at static init time is not going to be safe, since
 // we have no reason to expect this will be initted to a nullptr yet.
-UniquePtr<TestStunServer> TestStunServer::instance;
-UniquePtr<TestStunTcpServer> TestStunTcpServer::instance;
-UniquePtr<TestStunServer> TestStunServer::instance6;
-UniquePtr<TestStunTcpServer> TestStunTcpServer::instance6;
+TestStunServer *TestStunServer::instance;
+TestStunTcpServer *TestStunTcpServer::instance;
+TestStunServer *TestStunServer::instance6;
+TestStunTcpServer *TestStunTcpServer::instance6;
 uint16_t TestStunServer::instance_port = 3478;
 uint16_t TestStunTcpServer::instance_port = 3478;
 
 TestStunServer::~TestStunServer() {
   // TODO(ekr@rtfm.com): Put this on the right thread.
 
   // Unhook callback from our listen socket.
   if (listen_sock_) {
@@ -319,60 +318,62 @@ int TestStunServer::Initialize(int addre
   }
 
   listen_addr_ = addr_string;
   listen_port_ = instance_port;
 
   return 0;
 }
 
-UniquePtr<TestStunServer> TestStunServer::Create(int address_family) {
+TestStunServer* TestStunServer::Create(int address_family) {
   NR_reg_init(NR_REG_MODE_LOCAL);
 
-  UniquePtr<TestStunServer> server(new TestStunServer());
+  ScopedDeletePtr<TestStunServer> server(new TestStunServer());
 
   if (server->Initialize(address_family))
     return nullptr;
 
   NR_SOCKET fd;
   int r = nr_socket_getfd(server->listen_sock_, &fd);
   if (r) {
     MOZ_MTLOG(ML_ERROR, "Couldn't get fd");
     return nullptr;
   }
 
   NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunServer::readable_cb, server.get());
 
-  return server;
+  return server.forget();
 }
 
 void TestStunServer::ConfigurePort(uint16_t port) {
   instance_port = port;
 }
 
 TestStunServer* TestStunServer::GetInstance(int address_family) {
   switch (address_family) {
     case AF_INET:
       if (!instance)
         instance = Create(address_family);
 
       MOZ_ASSERT(instance);
-      return instance.get();
+      return instance;
     case AF_INET6:
       if (!instance6)
         instance6 = Create(address_family);
 
-      return instance6.get();
+      return instance6;
     default:
       MOZ_CRASH();
   }
 }
 
 void TestStunServer::ShutdownInstance() {
+  delete instance;
   instance = nullptr;
+  delete instance6;
   instance6 = nullptr;
 }
 
 
 struct DeferredStunOperation {
   DeferredStunOperation(TestStunServer *server,
                         const char *data, size_t len,
                         nr_transport_addr *addr,
@@ -531,29 +532,31 @@ void TestStunTcpServer::ConfigurePort(ui
 
 TestStunTcpServer* TestStunTcpServer::GetInstance(int address_family) {
   switch (address_family) {
     case AF_INET:
       if (!instance)
         instance = Create(address_family);
 
       MOZ_ASSERT(instance);
-      return instance.get();
+      return instance;
     case AF_INET6:
       if (!instance6)
         instance6 = Create(address_family);
 
-      return instance6.get();
+      return instance6;
     default:
       MOZ_CRASH();
   }
 }
 
 void TestStunTcpServer::ShutdownInstance() {
+  delete instance;
   instance = nullptr;
+  delete instance6;
   instance6 = nullptr;
 }
 
 int TestStunTcpServer::TryOpenListenSocket(nr_local_addr *addr, uint16_t port) {
 
   addr->addr.protocol=IPPROTO_TCP;
 
   int r = SetInternalPort(addr, port);
@@ -623,34 +626,34 @@ void TestStunTcpServer::accept_cb(NR_SOC
     return;
   }
 
   server->connections_[fd] = wrapsock;
 
   NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunServer::readable_cb, server);
 }
 
-  UniquePtr<TestStunTcpServer> TestStunTcpServer::Create(int address_family) {
+TestStunTcpServer* TestStunTcpServer::Create(int address_family) {
   NR_reg_init(NR_REG_MODE_LOCAL);
 
-  UniquePtr<TestStunTcpServer> server(new TestStunTcpServer());
+  ScopedDeletePtr<TestStunTcpServer> server(new TestStunTcpServer());
 
   if (server->Initialize(address_family)) {
     return nullptr;
   }
 
   NR_SOCKET fd;
   if(nr_socket_getfd(server->listen_sock_, &fd)) {
     MOZ_MTLOG(ML_ERROR, "Couldn't get tcp fd");
     return nullptr;
   }
 
   NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunTcpServer::accept_cb, server.get());
 
-  return server;
+  return server.forget();
 }
 
 TestStunTcpServer::~TestStunTcpServer() {
   for (auto it = connections_.begin(); it != connections_.end();) {
     NR_ASYNC_CANCEL(it->first, NR_ASYNC_WAIT_READ);
     nr_socket_destroy(&it->second);
     connections_.erase(it++);
   }
--- a/media/mtransport/test/stunserver.h
+++ b/media/mtransport/test/stunserver.h
@@ -8,17 +8,16 @@
 
 #ifndef stunserver_h__
 #define stunserver_h__
 
 #include <map>
 #include <string>
 #include "prio.h"
 #include "nsError.h"
-#include "mozilla/UniquePtr.h"
 
 typedef struct nr_stun_server_ctx_ nr_stun_server_ctx;
 typedef struct nr_socket_ nr_socket;
 typedef struct nr_local_addr_ nr_local_addr;
 
 
 namespace mozilla {
 
@@ -27,17 +26,17 @@ class TestStunServer {
   // Generally, you should only call API in this class from the same thread that
   // the initial |GetInstance| call was made from.
   static TestStunServer *GetInstance(int address_family = AF_INET);
   static void ShutdownInstance();
   // |ConfigurePort| will only have an effect if called before the first call
   // to |GetInstance| (possibly following a |ShutdownInstance| call)
   static void ConfigurePort(uint16_t port);
   // AF_INET, AF_INET6
-  static UniquePtr<TestStunServer> Create(int address_family);
+  static TestStunServer *Create(int address_family);
 
   virtual ~TestStunServer();
 
   void SetActive(bool active);
   void SetDelay(uint32_t delay_ms);
   void SetDropInitialPackets(uint32_t count);
   const std::string& addr() const { return listen_addr_; }
   uint16_t port() const { return listen_port_; }
@@ -85,18 +84,18 @@ class TestStunServer {
  private:
   bool active_;
   uint32_t delay_ms_;
   uint32_t initial_ct_;
   nr_transport_addr *response_addr_;
   void *timer_handle_;
   std::map<std::string, uint32_t> received_ct_;
 
-  static UniquePtr<TestStunServer> instance;
-  static UniquePtr<TestStunServer> instance6;
+  static TestStunServer *instance;
+  static TestStunServer *instance6;
   static uint16_t instance_port;
 };
 
 class TestStunTcpServer: public TestStunServer {
  public:
   static TestStunTcpServer *GetInstance(int address_family);
   static void ShutdownInstance();
   static void ConfigurePort(uint16_t port);
@@ -106,18 +105,18 @@ class TestStunTcpServer: public TestStun
   virtual nr_socket* GetSendingSocket(nr_socket *sock);
 
  protected:
   TestStunTcpServer() {}
   static void accept_cb(NR_SOCKET sock, int how, void *cb_arg);
 
  private:
   virtual int TryOpenListenSocket(nr_local_addr *addr, uint16_t port);
-  static UniquePtr<TestStunTcpServer> Create(int address_family);
+  static TestStunTcpServer *Create(int address_family);
 
-  static UniquePtr<TestStunTcpServer> instance;
-  static UniquePtr<TestStunTcpServer> instance6;
+  static TestStunTcpServer *instance;
+  static TestStunTcpServer *instance6;
   static uint16_t instance_port;
 
   std::map<NR_SOCKET, nr_socket*> connections_;
 };
 } // End of namespace mozilla
 #endif
--- a/media/mtransport/test/turn_unittest.cpp
+++ b/media/mtransport/test/turn_unittest.cpp
@@ -44,16 +44,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
 #include "sigslot.h"
 
 #include "logging.h"
 #include "nspr.h"
 #include "nss.h"
 #include "ssl.h"
 
+#include "mozilla/Scoped.h"
 #include "nsThreadUtils.h"
 #include "nsXPCOM.h"
 
 #include "runnable_utils.h"
 
 #define GTEST_HAS_RTTI 0
 #include "gtest/gtest.h"
 #include "gtest_utils.h"
--- a/media/mtransport/transportflow.cpp
+++ b/media/mtransport/transportflow.cpp
@@ -30,24 +30,24 @@ TransportFlow::~TransportFlow() {
 
   // Push the destruction onto the STS thread. Note that there
   // is still some possibility that someone is accessing this
   // object simultaneously, but as long as smart pointer discipline
   // is maintained, it shouldn't be possible to access and
   // destroy it simultaneously. The conversion to an nsAutoPtr
   // ensures automatic destruction of the queue at exit of
   // DestroyFinal.
-  nsAutoPtr<std::deque<TransportLayer*>> layers_tmp(layers_.release());
+  nsAutoPtr<std::deque<TransportLayer*> > layers_tmp(layers_.forget());
   RUN_ON_THREAD(target_,
                 WrapRunnableNM(&TransportFlow::DestroyFinal, layers_tmp),
                 NS_DISPATCH_NORMAL);
 }
 
 void TransportFlow::DestroyFinal(nsAutoPtr<std::deque<TransportLayer *> > layers) {
-  ClearLayers(layers.get());
+  ClearLayers(layers);
 }
 
 void TransportFlow::ClearLayers(std::queue<TransportLayer *>* layers) {
   while (!layers->empty()) {
     delete layers->front();
     layers->pop();
   }
 }
@@ -56,17 +56,17 @@ void TransportFlow::ClearLayers(std::deq
   while (!layers->empty()) {
     delete layers->front();
     layers->pop_front();
   }
 }
 
 nsresult TransportFlow::PushLayer(TransportLayer *layer) {
   CheckThread();
-  UniquePtr<TransportLayer> layer_tmp(layer);  // Destroy on failure.
+  ScopedDeletePtr<TransportLayer> layer_tmp(layer);  // Destroy on failure.
 
   // Don't allow pushes once we are in error state.
   if (state_ == TransportLayer::TS_ERROR) {
     MOZ_MTLOG(ML_ERROR, id_ + ": Can't call PushLayer in error state for flow");
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv = layer->Init();
@@ -85,17 +85,17 @@ nsresult TransportFlow::PushLayer(Transp
 
   TransportLayer *old_layer = layers_->empty() ? nullptr : layers_->front();
 
   // Re-target my signals to the new layer
   if (old_layer) {
     old_layer->SignalStateChange.disconnect(this);
     old_layer->SignalPacketReceived.disconnect(this);
   }
-  layers_->push_front(layer_tmp.release());
+  layers_->push_front(layer_tmp.forget());
   layer->Inserted(this, old_layer);
 
   layer->SignalStateChange.connect(this, &TransportFlow::StateChange);
   layer->SignalPacketReceived.connect(this, &TransportFlow::PacketReceived);
   StateChangeInt(layer->state());
 
   return NS_OK;
 }
@@ -141,21 +141,21 @@ nsresult TransportFlow::PushLayers(nsAut
     // Push the layer onto the queue.
     layers_->push_front(layer);
     layers->pop();
     layer->Inserted(this, old_layer);
   }
 
   if (NS_FAILED(rv)) {
     // Destroy any layers we could not push.
-    ClearLayers(layers.get());
+    ClearLayers(layers);
 
     // Now destroy the rest of the flow, because it's no longer
     // in an acceptable state.
-    ClearLayers(layers_.get());
+    ClearLayers(layers_);
 
     // Set ourselves to have failed.
     StateChangeInt(TransportLayer::TS_ERROR);
 
     // Return failure.
     return rv;
   }
 
--- a/media/mtransport/transportflow.h
+++ b/media/mtransport/transportflow.h
@@ -10,17 +10,17 @@
 #define transportflow_h__
 
 #include <deque>
 #include <queue>
 #include <string>
 
 #include "nscore.h"
 #include "nsISupportsImpl.h"
-#include "mozilla/UniquePtr.h"
+#include "mozilla/Scoped.h"
 #include "transportlayer.h"
 #include "m_cpp_utils.h"
 #include "nsAutoPtr.h"
 
 // A stack of transport layers acts as a flow.
 // Generally, one reads and writes to the top layer.
 
 // This code has a confusing hybrid threading model which
@@ -130,14 +130,14 @@ class TransportFlow final : public nsISu
   static void DestroyFinal(nsAutoPtr<std::deque<TransportLayer *> > layers);
 
   // Overload needed because we use deque internally and queue externally.
   static void ClearLayers(std::deque<TransportLayer *>* layers);
   static void ClearLayers(std::queue<TransportLayer *>* layers);
 
   std::string id_;
   TransportLayer::State state_;
-  UniquePtr<std::deque<TransportLayer *>> layers_;
+  ScopedDeletePtr<std::deque<TransportLayer *> > layers_;
   nsCOMPtr<nsIEventTarget> target_;
 };
 
 }  // close namespace
 #endif
--- a/media/mtransport/transportlayerdtls.cpp
+++ b/media/mtransport/transportlayerdtls.cpp
@@ -458,17 +458,17 @@ TransportLayerDtls::SetVerificationDiges
 bool TransportLayerDtls::Setup() {
   CheckThread();
   SECStatus rv;
 
   if (!downward_) {
     MOZ_MTLOG(ML_ERROR, "DTLS layer with nothing below. This is useless");
     return false;
   }
-  nspr_io_adapter_ = MakeUnique<TransportLayerNSPRAdapter>(downward_);
+  nspr_io_adapter_ = new TransportLayerNSPRAdapter(downward_);
 
   if (!identity_) {
     MOZ_MTLOG(ML_ERROR, "Can't start DTLS without an identity");
     return false;
   }
 
   if (verification_mode_ == VERIFY_UNSET) {
     MOZ_MTLOG(ML_ERROR,
--- a/media/mtransport/transportlayerdtls.h
+++ b/media/mtransport/transportlayerdtls.h
@@ -10,17 +10,17 @@
 #define transportlayerdtls_h__
 
 #include <queue>
 #include <set>
 
 #include "sigslot.h"
 
 #include "mozilla/RefPtr.h"
-#include "mozilla/UniquePtr.h"
+#include "mozilla/Scoped.h"
 #include "nsCOMPtr.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 #include "ScopedNSSTypes.h"
 #include "m_cpp_utils.h"
 #include "dtlsidentity.h"
 #include "transportflow.h"
 #include "transportlayer.h"
@@ -172,17 +172,17 @@ class TransportLayerDtls final : public 
   std::vector<uint16_t> srtp_ciphers_;
 
   Role role_;
   Verification verification_mode_;
   std::vector<RefPtr<VerificationDigest> > digests_;
 
   // Must delete nspr_io_adapter after ssl_fd_ b/c ssl_fd_ causes an alert
   // (ssl_fd_ contains an un-owning pointer to nspr_io_adapter_)
-  UniquePtr<TransportLayerNSPRAdapter> nspr_io_adapter_;
+  ScopedDeletePtr<TransportLayerNSPRAdapter> nspr_io_adapter_;
   ScopedPRFileDesc ssl_fd_;
 
   ScopedCERTCertificate peer_cert_;
   nsCOMPtr<nsITimer> timer_;
   bool auth_hook_called_;
   bool cert_ok_;
 };
 
--- a/media/mtransport/transportlayerice.h
+++ b/media/mtransport/transportlayerice.h
@@ -10,16 +10,17 @@
 #ifndef transportlayerice_h__
 #define transportlayerice_h__
 
 #include <vector>
 
 #include "sigslot.h"
 
 #include "mozilla/RefPtr.h"
+#include "mozilla/Scoped.h"
 #include "nsCOMPtr.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 
 #include "m_cpp_utils.h"
 
 #include "nricemediastream.h"
 #include "transportflow.h"
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -3,16 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebrtcGmpVideoCodec.h"
 
 #include <iostream>
 #include <vector>
 
 #include "mozilla/Move.h"
+#include "mozilla/Scoped.h"
 #include "mozilla/SyncRunnable.h"
 #include "VideoConduit.h"
 #include "AudioConduit.h"
 #include "runnable_utils.h"
 
 #include "mozIGeckoMediaPluginService.h"
 #include "nsServiceManagerUtils.h"
 #include "GMPVideoDecoderProxy.h"
--- a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
@@ -7,16 +7,17 @@
 #include <queue>
 
 #include "CSFLog.h"
 #include "nspr.h"
 
 #include "MediaCodec.h"
 #include "WebrtcMediaCodecVP8VideoCodec.h"
 #include "AndroidJNIWrapper.h"
+#include "mozilla/Scoped.h"
 #include "mozilla/ArrayUtils.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Monitor.h"
 #include "runnable_utils.h"
 
 #include "AudioConduit.h"
 #include "VideoConduit.h"
 #include "libyuv/convert_from.h"
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -508,20 +508,21 @@ void MediaPipeline::RtpPacketReceived(Tr
     ssrcs_received_.push_back(header.ssrc);
   }
 
   if (filter_ && !filter_->Filter(header)) {
     return;
   }
 
   // Make a copy rather than cast away constness
-  auto inner_data = MakeUnique<unsigned char[]>(len);
-  memcpy(inner_data.get(), data, len);
+  ScopedDeletePtr<unsigned char> inner_data(
+      new unsigned char[len]);
+  memcpy(inner_data, data, len);
   int out_len = 0;
-  nsresult res = rtp_.recv_srtp_->UnprotectRtp(inner_data.get(),
+  nsresult res = rtp_.recv_srtp_->UnprotectRtp(inner_data,
                                                len, len, &out_len);
   if (!NS_SUCCEEDED(res)) {
     char tmp[16];
 
     PR_snprintf(tmp, sizeof(tmp), "%.2x %.2x %.2x %.2x",
                 inner_data[0],
                 inner_data[1],
                 inner_data[2],
@@ -530,17 +531,17 @@ void MediaPipeline::RtpPacketReceived(Tr
     MOZ_MTLOG(ML_NOTICE, "Error unprotecting RTP in " << description_
               << "len= " << len << "[" << tmp << "...]");
 
     return;
   }
   MOZ_MTLOG(ML_DEBUG, description_ << " received RTP packet.");
   increment_rtp_packets_received(out_len);
 
-  (void)conduit_->ReceivedRTPPacket(inner_data.get(), out_len);  // Ignore error codes
+  (void)conduit_->ReceivedRTPPacket(inner_data, out_len);  // Ignore error codes
 }
 
 void MediaPipeline::RtcpPacketReceived(TransportLayer *layer,
                                        const unsigned char *data,
                                        size_t len) {
   if (!transport_->pipeline()) {
     MOZ_MTLOG(ML_DEBUG, "Discarding incoming packet; transport disconnected");
     return;
@@ -566,43 +567,44 @@ void MediaPipeline::RtcpPacketReceived(T
   }
 
   // Filter out everything but RTP/RTCP
   if (data[0] < 128 || data[0] > 191) {
     return;
   }
 
   // Make a copy rather than cast away constness
-  auto inner_data = MakeUnique<unsigned char[]>(len);
-  memcpy(inner_data.get(), data, len);
+  ScopedDeletePtr<unsigned char> inner_data(
+      new unsigned char[len]);
+  memcpy(inner_data, data, len);
   int out_len;
 
-  nsresult res = rtcp_.recv_srtp_->UnprotectRtcp(inner_data.get(),
+  nsresult res = rtcp_.recv_srtp_->UnprotectRtcp(inner_data,
                                                  len,
                                                  len,
                                                  &out_len);
 
   if (!NS_SUCCEEDED(res))
     return;
 
   // We do not filter RTCP for send pipelines, since the webrtc.org code for
   // senders already has logic to ignore RRs that do not apply.
   if (filter_ && direction_ == RECEIVE) {
-    if (!filter_->FilterSenderReport(inner_data.get(), out_len)) {
+    if (!filter_->FilterSenderReport(inner_data, out_len)) {
       MOZ_MTLOG(ML_NOTICE, "Dropping rtcp packet");
       return;
     }
   }
 
   MOZ_MTLOG(ML_DEBUG, description_ << " received RTCP packet.");
   increment_rtcp_packets_received();
 
   MOZ_ASSERT(rtcp_.recv_srtp_);  // This should never happen
 
-  (void)conduit_->ReceivedRTCPPacket(inner_data.get(), out_len);  // Ignore error codes
+  (void)conduit_->ReceivedRTCPPacket(inner_data, out_len);  // Ignore error codes
 }
 
 bool MediaPipeline::IsRtp(const unsigned char *data, size_t len) {
   if (len < 2)
     return false;
 
   // Check if this is a RTCP packet. Logic based on the types listed in
   // media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -120,33 +120,33 @@ JsepCodecDescToCodecConfig(const JsepCod
 
   uint16_t pt;
 
   if (!desc.GetPtAsInt(&pt)) {
     MOZ_MTLOG(ML_ERROR, "Invalid payload type: " << desc.mDefaultPt);
     return NS_ERROR_INVALID_ARG;
   }
 
-  UniquePtr<VideoCodecConfigH264> h264Config;
+  ScopedDeletePtr<VideoCodecConfigH264> h264Config;
 
   if (desc.mName == "H264") {
-    h264Config = MakeUnique<VideoCodecConfigH264>();
+    h264Config = new VideoCodecConfigH264;
     size_t spropSize = sizeof(h264Config->sprop_parameter_sets);
     strncpy(h264Config->sprop_parameter_sets,
             desc.mSpropParameterSets.c_str(),
             spropSize);
     h264Config->sprop_parameter_sets[spropSize - 1] = '\0';
     h264Config->packetization_mode = desc.mPacketizationMode;
     h264Config->profile_level_id = desc.mProfileLevelId;
     h264Config->tias_bw = 0; // TODO. Issue 165.
   }
 
   VideoCodecConfig* configRaw;
   configRaw = new VideoCodecConfig(
-      pt, desc.mName, desc.mConstraints, h264Config.get());
+      pt, desc.mName, desc.mConstraints, h264Config);
 
   configRaw->mAckFbTypes = desc.mAckFbTypes;
   configRaw->mNackFbTypes = desc.mNackFbTypes;
   configRaw->mCcmFbTypes = desc.mCcmFbTypes;
 
   *aConfig = configRaw;
   return NS_OK;
 }
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -152,38 +152,40 @@ class PeerConnectionConfiguration
 public:
   PeerConnectionConfiguration()
   : mBundlePolicy(kBundleBalanced),
     mIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL) {}
 
   bool addStunServer(const std::string& addr, uint16_t port,
                      const char* transport)
   {
-    UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(addr, port, transport));
+    NrIceStunServer* server(NrIceStunServer::Create(addr, port, transport));
     if (!server) {
       return false;
     }
     addStunServer(*server);
+    delete server;
     return true;
   }
   bool addTurnServer(const std::string& addr, uint16_t port,
                      const std::string& username,
                      const std::string& pwd,
                      const char* transport)
   {
     // TODO(ekr@rtfm.com): Need support for SASLprep for
     // username and password. Bug # ???
     std::vector<unsigned char> password(pwd.begin(), pwd.end());
 
-    UniquePtr<NrIceTurnServer> server(NrIceTurnServer::Create(addr, port, username, password,
-							      transport));
+    NrIceTurnServer* server(NrIceTurnServer::Create(addr, port, username, password,
+                                                    transport));
     if (!server) {
       return false;
     }
     addTurnServer(*server);
+    delete server;
     return true;
   }
   void addStunServer(const NrIceStunServer& server) { mStunServers.push_back (server); }
   void addTurnServer(const NrIceTurnServer& server) { mTurnServers.push_back (server); }
   const std::vector<NrIceStunServer>& getStunServers() const { return mStunServers; }
   const std::vector<NrIceTurnServer>& getTurnServers() const { return mTurnServers; }
   void setBundlePolicy(JsepBundlePolicy policy) { mBundlePolicy = policy;}
   JsepBundlePolicy getBundlePolicy() const { return mBundlePolicy; }
--- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp
+++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp
@@ -6,18 +6,18 @@
 #include <string>
 #include <fstream>
 #include <unistd.h>
 #include <vector>
 #include <math.h>
 
 using namespace std;
 
+#include "mozilla/Scoped.h"
 #include "mozilla/SyncRunnable.h"
-#include "mozilla/UniquePtr.h"
 #include <MediaConduitInterface.h>
 #include "GmpVideoCodec.h"
 #include "nsIEventTarget.h"
 #include "FakeMediaStreamsImpl.h"
 #include "FakeLogging.h"
 #include "nsThreadUtils.h"
 #include "runnable_utils.h"
 #include "signaling/src/common/EncodingConstraints.h"
@@ -87,40 +87,40 @@ public:
   }
   void SetRate(int r) {
     rate = r;
   }
   void Init(RefPtr<mozilla::VideoSessionConduit> aSession)
   {
         mSession = aSession;
         mLen = ((width * height) * 3 / 2);
-        mFrame = mozilla::MakeUnique<uint8_t[]>(mLen);
-        memset(mFrame.get(), COLOR, mLen);
+        mFrame = (uint8_t*) PR_MALLOC(mLen);
+        memset(mFrame, COLOR, mLen);
         numFrames = 121;
   }
 
   void GenerateAndReadSamples()
   {
     do
     {
-      mSession->SendVideoFrame(reinterpret_cast<unsigned char*>(mFrame.get()),
+      mSession->SendVideoFrame((unsigned char*)mFrame,
                                 mLen,
                                 width,
                                 height,
                                 mozilla::kVideoI420,
                                 0);
       PR_Sleep(PR_MillisecondsToInterval(1000/rate));
       vidStatsGlobal.numRawFramesInserted++;
       numFrames--;
     } while(numFrames >= 0);
   }
 
 private:
 RefPtr<mozilla::VideoSessionConduit> mSession;
-mozilla::UniquePtr<uint8_t[]> mFrame;
+mozilla::ScopedDeletePtr<uint8_t> mFrame;
 int mLen;
 int width, height;
 int rate;
 int numFrames;
 };
 
 
 
@@ -285,18 +285,18 @@ void AudioSendAndReceive::GenerateMusic(
     if(i%6==0)j++;
   }
   cerr << "Generating Input Music Done " << endl;
 }
 
 //Hardcoded for 16 bit samples for now
 void AudioSendAndReceive::GenerateAndReadSamples()
 {
-   mozilla::UniquePtr<int16_t[]> audioInput(mozilla::MakeUnique<int16_t []>(PLAYOUT_SAMPLE_LENGTH));
-   mozilla::UniquePtr<int16_t[]> audioOutput(mozilla::MakeUnique<int16_t []>(PLAYOUT_SAMPLE_LENGTH));
+   mozilla::ScopedDeletePtr<int16_t> audioInput(new int16_t [PLAYOUT_SAMPLE_LENGTH]);
+   mozilla::ScopedDeletePtr<int16_t> audioOutput(new int16_t [PLAYOUT_SAMPLE_LENGTH]);
    short* inbuf;
    int sampleLengthDecoded = 0;
    unsigned int SAMPLES = (PLAYOUT_SAMPLE_FREQUENCY * 10); //10 seconds
    int CHANNELS = 1; //mono audio
    int sampleLengthInBytes = sizeof(int16_t) * PLAYOUT_SAMPLE_LENGTH;
    //generated audio buffer
    inbuf = (short *)moz_xmalloc(sizeof(short)*SAMPLES*CHANNELS);
    memset(audioInput.get(),0,sampleLengthInBytes);
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -1683,29 +1683,29 @@ class SignalingAgentTest : public ::test
     }
   }
 
   bool CreateAgent() {
     return CreateAgent(g_stun_server_address, g_stun_server_port);
   }
 
   bool CreateAgent(const std::string stun_addr, uint16_t stun_port) {
-    UniquePtr<SignalingAgent> agent(
+    ScopedDeletePtr<SignalingAgent> agent(
         new SignalingAgent("agent", stun_addr, stun_port));
 
     agent->Init();
 
-    agents_.push_back(agent.release());
+    agents_.push_back(agent.forget());
 
     return true;
   }
 
   void CreateAgentNoInit() {
-    UniquePtr<SignalingAgent> agent(new SignalingAgent("agent"));
-    agents_.push_back(agent.release());
+    ScopedDeletePtr<SignalingAgent> agent(new SignalingAgent("agent"));
+    agents_.push_back(agent.forget());
   }
 
   SignalingAgent *agent(size_t i) {
     return agents_[i];
   }
 
  private:
   std::vector<SignalingAgent *> agents_;
@@ -1744,18 +1744,18 @@ public:
   static void SetUpTestCase() {
   }
 
   void EnsureInit() {
 
     if (init_)
       return;
 
-    a1_ = MakeUnique<SignalingAgent>(callerName, stun_addr_, stun_port_);
-    a2_ = MakeUnique<SignalingAgent>(calleeName, stun_addr_, stun_port_);
+    a1_ = new SignalingAgent(callerName, stun_addr_, stun_port_);
+    a2_ = new SignalingAgent(calleeName, stun_addr_, stun_port_);
 
     if (GetParam() == "no_bundle") {
       a1_->SetBundleEnabled(false);
     } else if(GetParam() == "reject_bundle") {
       a2_->SetBundleEnabled(false);
     } else if (GetParam() == "max-bundle") {
       a1_->SetBundlePolicy(JsepBundlePolicy::kBundleMaxBundle);
       a2_->SetBundlePolicy(JsepBundlePolicy::kBundleMaxBundle);
@@ -2165,18 +2165,18 @@ public:
     a1_->CloseSendStreams();
     a2_->CloseSendStreams();
     a1_->CloseReceiveStreams();
     a2_->CloseReceiveStreams();
   }
 
  protected:
   bool init_;
-  UniquePtr<SignalingAgent> a1_;  // Canonically "caller"
-  UniquePtr<SignalingAgent> a2_;  // Canonically "callee"
+  ScopedDeletePtr<SignalingAgent> a1_;  // Canonically "caller"
+  ScopedDeletePtr<SignalingAgent> a2_;  // Canonically "callee"
   std::string stun_addr_;
   uint16_t stun_port_;
 };
 
 static void SetIntPrefOnMainThread(nsCOMPtr<nsIPrefBranch> prefs,
   const char *pref_name,
   int new_value) {
   MOZ_ASSERT(NS_IsMainThread());