Closed Bug 1161433 Opened 9 years ago Closed 9 years ago

Empty gUM constraints throw wrong error

Categories

(Core :: WebRTC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: drno, Assigned: drno)

References

Details

Attachments

(2 files, 1 obsolete file)

If I pass {} as constraints into gUM I get "PermissionDeniedError: The user did not grant permission for the operation." as error.

But according to https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia point 3, point 2 it should throw a NotSupportedError, which seems more reasonable.
Assignee: nobody → drno
Attached file MozReview Request: bz://1161433/drno (obsolete) —
/r/8277 - Bug 1161433: return NotSupportedError for constraints without audio or video
/r/8279 - Bug 1161433: mochitest for new empty constraint error message

Pull down these commits:

hg pull -r bfb3130f29cb6a5240c3b353a81c0d9845ec85f3 https://reviewboard-hg.mozilla.org/gecko/
Attachment #8602384 - Flags: review?(jib)
Comment on attachment 8602384 [details]
MozReview Request: bz://1161433/drno

https://reviewboard.mozilla.org/r/8275/#review7033

Lgtm with nit.

::: dom/media/MediaManager.cpp:1250
(Diff revision 1)
> +    if (!mAudioDevice && !mVideoDevice) {
> +      Fail(NS_LITERAL_STRING("NotFoundError"));
> +      return;
> +    }

Not important, but would it be better to move this to the end of SelectDevice() so all the Fail()s are together?

There's no way for mDeviceChosen above here to be true without either mAudioDevice and mVideoDevice set, so works either way.

::: dom/media/tests/mochitest/test_getUserMedia_constraints.html:53
(Diff revision 1)
> +  { message: "missing audio or video fails",
> +    constraints: { abc: true },
> +    error: "NotSupportedError" },
> +  { message: "emtpy constraint fails",
> +    constraints: { },
> +    error: "NotSupportedError" },

I believe WebIDL guarantees that one of these is enough.
Attachment #8602384 - Flags: review?(jib) → review+
Comment on attachment 8602384 [details]
MozReview Request: bz://1161433/drno

/r/8277 - Bug 1161433: return NotSupportedError for constraints without audio or video
/r/8279 - Bug 1161433: mochitest for new empty constraint error message

Pull down these commits:

hg pull -r 1664c6b9ab58f52753da8444e57b89da1af9dd0e https://reviewboard-hg.mozilla.org/gecko/
Attachment #8602384 - Flags: review+ → review?(jib)
Comment on attachment 8602384 [details]
MozReview Request: bz://1161433/drno

Just did the requested changes from jib. Carrying forward r+=jib (no idea how to that with review board).
Attachment #8602384 - Flags: review?(jib) → review+
https://hg.mozilla.org/mozilla-central/rev/bf588f714b31
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Attachment #8602384 - Attachment is obsolete: true
Attachment #8620230 - Flags: review+
Attachment #8620231 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: