Bug 1088621 - Fix bug where NotReadableError rather than OverconstrainedError was thrown. draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Tue, 26 Jul 2016 23:56:22 -0400
changeset 396972 3467b3bcfb4dcdb82da4a0f257d9f1f78d290a06
parent 396971 d07adad54619cb63397b48f7e27d26be61f71d9a
child 396973 15e960c6c6a37d31fe8e0d480e47223d1b66dca4
push id25164
push userjbruaroey@mozilla.com
push dateFri, 05 Aug 2016 00:07:54 +0000
bugs1088621
milestone51.0a1
Bug 1088621 - Fix bug where NotReadableError rather than OverconstrainedError was thrown. MozReview-Commit-ID: G0xSmzGhiB2
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1472,28 +1472,23 @@ public:
         }
         if (mAudioDevice) {
           mAudioDevice->Deallocate();
         }
       }
     }
     if (errorMsg) {
       LOG(("%s %d", errorMsg, rv));
-      switch (rv) {
-        case NS_ERROR_NOT_AVAILABLE: {
-          MOZ_ASSERT(badConstraint);
-          Fail(NS_LITERAL_STRING("OverconstrainedError"),
-               NS_LITERAL_STRING(""),
-               NS_ConvertUTF8toUTF16(badConstraint));
-          break;
-        }
-        default:
-          Fail(NS_LITERAL_STRING("NotReadableError"),
-               NS_ConvertUTF8toUTF16(errorMsg));
-          break;
+      if (badConstraint) {
+        Fail(NS_LITERAL_STRING("OverconstrainedError"),
+             NS_LITERAL_STRING(""),
+             NS_ConvertUTF8toUTF16(badConstraint));
+      } else {
+        Fail(NS_LITERAL_STRING("NotReadableError"),
+             NS_ConvertUTF8toUTF16(errorMsg));
       }
       return NS_OK;
     }
     PeerIdentity* peerIdentity = nullptr;
     if (!mConstraints.mPeerIdentity.IsEmpty()) {
       peerIdentity = new PeerIdentity(mConstraints.mPeerIdentity);
     }