Backed out changeset 98bc69015608 (bug 1139721) for frequent b2g mochitest-5 failures
authorWes Kocher <wkocher@mozilla.com>
Mon, 16 Mar 2015 14:16:02 -0700
changeset 233859 355ac9495b03499bf373537524c508c2f9963ade
parent 233858 0f06c9f45cde2c1e1faf349dbfc1e80c66bb20d7
child 233860 865c73098cd21e2d46141e367ab0fa803f6c42ce
push id11813
push usercbook@mozilla.com
push dateTue, 17 Mar 2015 10:55:17 +0000
treeherderfx-team@655bf846ef73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1139721
milestone39.0a1
backs out98bc690156084571595c667d7c8bb7ee972f5408
Backed out changeset 98bc69015608 (bug 1139721) for frequent b2g mochitest-5 failures
dom/camera/DOMCameraCapabilities.cpp
dom/camera/DOMCameraControl.cpp
--- a/dom/camera/DOMCameraCapabilities.cpp
+++ b/dom/camera/DOMCameraCapabilities.cpp
@@ -318,17 +318,16 @@ CameraCapabilities::HasSupport(JSContext
 }
 
 CameraCapabilities::CameraCapabilities(nsPIDOMWindow* aWindow,
                                        ICameraControl* aCameraControl)
   : mWindow(aWindow)
   , mCameraControl(aCameraControl)
 {
   DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
-  MOZ_COUNT_CTOR(CameraCapabilities);
   if (mCameraControl) {
     mListener = new CameraClosedListenerProxy<CameraCapabilities>(this);
     mCameraControl->AddListener(mListener);
   }
 }
 
 CameraCapabilities::~CameraCapabilities()
 {
--- a/dom/camera/DOMCameraControl.cpp
+++ b/dom/camera/DOMCameraControl.cpp
@@ -301,17 +301,17 @@ nsDOMCameraControl::nsDOMCameraControl(u
   if (NS_FAILED(rv)) {
     mListener->OnUserError(DOMCameraControlListener::kInStartCamera, rv);
   }
 }
 
 nsDOMCameraControl::~nsDOMCameraControl()
 {
   DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
-  /*invoke DOMMediaStream destroy*/
+  /*invoke DOMMdediastream destroy*/
   Destroy();
 }
 
 JSObject*
 nsDOMCameraControl::WrapObject(JSContext* aCx)
 {
   return CameraControlBinding::Wrap(aCx, this);
 }
@@ -1368,19 +1368,20 @@ nsDOMCameraControl::OnFacesDetected(cons
 {
   DOM_CAMERA_LOGI("DOM OnFacesDetected %zu face(s)\n", aFaces.Length());
   MOZ_ASSERT(NS_IsMainThread());
 
   Sequence<OwningNonNull<DOMCameraDetectedFace> > faces;
   uint32_t len = aFaces.Length();
 
   if (faces.SetCapacity(len)) {
+    nsRefPtr<DOMCameraDetectedFace> f;
     for (uint32_t i = 0; i < len; ++i) {
-      *faces.AppendElement() =
-        new DOMCameraDetectedFace(static_cast<DOMMediaStream*>(this), aFaces[i]);
+      f = new DOMCameraDetectedFace(static_cast<DOMMediaStream*>(this), aFaces[i]);
+      *faces.AppendElement() = f.forget().take();
     }
   }
 
   CameraFacesDetectedEventInit eventInit;
   eventInit.mFaces.SetValue(faces);
 
   nsRefPtr<CameraFacesDetectedEvent> event =
     CameraFacesDetectedEvent::Constructor(this,
@@ -1421,20 +1422,16 @@ nsDOMCameraControl::OnUserError(CameraCo
     this, aContext, aError);
   MOZ_ASSERT(NS_IsMainThread());
 
   nsRefPtr<Promise> promise;
 
   switch (aContext) {
     case CameraControlListener::kInStartCamera:
       promise = mGetCameraPromise.forget();
-      // If we failed to open the camera, we never actually provided a reference
-      // for the application to release explicitly. Thus we must clear our handle
-      // here to ensure everything is freed.
-      mCameraControl = nullptr;
       break;
 
     case CameraControlListener::kInStopCamera:
       promise = mReleasePromise.forget();
       if (aError == NS_ERROR_NOT_INITIALIZED) {
         // This value indicates that the hardware is already closed; which for
         // kInStopCamera, is not actually an error.
         if (promise) {