Bug 1088621 - Fix bug where NotReadableError rather than OverconstrainedError was thrown.
MozReview-Commit-ID: G0xSmzGhiB2
--- 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);
}