Bug 927358: Was mistake to begin failing on unsupported mandatory constraints. r=jesup

This commit is contained in:
Jan-Ivar Bruaroey 2013-11-22 16:10:00 -05:00
parent 6789e60ca8
commit d2b41c5e14
2 changed files with 11 additions and 16 deletions

View File

@ -1276,17 +1276,19 @@ MediaManager::GetUserMedia(JSContext* aCx, bool aPrivileged,
if (!unknownConstraintFound.IsEmpty()) {
// An unsupported mandatory constraint was found.
// Things are set up enough here that we can fire Error callback.
//
// We continue to ignore these for now, because we implement just
// facingMode, which means all existing uses of mandatory width/height would
// fail on Firefox only otherwise, which is undesirable.
//
// There's also basis for always ignoring them in a new proposal.
// TODO(jib): This is a super-low-risk fix for backport. Clean up later.
LOG(("Unsupported mandatory constraint: %s\n",
NS_ConvertUTF16toUTF8(unknownConstraintFound).get()));
nsString errormsg(NS_LITERAL_STRING("NOT_SUPPORTED_ERR: "));
errormsg.Append(unknownConstraintFound);
NS_DispatchToMainThread(new ErrorCallbackRunnable(onSuccess.forget(),
onError.forget(),
errormsg, windowID));
return NS_OK;
// unknown constraints existed in aRawConstraints only, which is unused
// from here, so continuing here effectively ignores them, as is desired.
}
// Ensure there's a thread for gum to proxy to off main thread

View File

@ -25,14 +25,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=882145
*/
var tests = [
// Each test here tests a different constraint or codepath.
{ message: "unknown mandatory constraint on video fails",
constraints: { video: { mandatory: { somethingUnknown:0 } } },
error: "NOT_SUPPORTED_ERR: somethingUnknown",
pass: false },
{ message: "unknown mandatory constraint on audio fails",
constraints: { audio: { mandatory: { somethingUnknown:0 } } },
error: "NOT_SUPPORTED_ERR: somethingUnknown",
pass: false },
{ message: "video overconstrained by facingMode fails",
constraints: { video: { mandatory: { facingMode:'left' } } },
error: "NO_DEVICES_FOUND",
@ -40,7 +32,8 @@ var tests = [
{ message: "Success-path: optional video facingMode + audio ignoring facingMode",
constraints: { fake: true,
audio: { mandatory: { facingMode:'left' } },
video: { optional: [{ facingMode:'left' },
video: { mandatory: { somethingUnknown:0 },
optional: [{ facingMode:'left' },
{ facingMode:'right' },
{ facingMode:'environment' },
{ facingMode:'user' },