WebKit Bugzilla
Attachment 359558 Details for
Bug 193541
: getUserMedia with a deviceId exact constraint with an empty string value should succeed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193541-20190118170315.patch (text/plain), 4.46 KB, created by
youenn fablet
on 2019-01-18 17:03:17 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-18 17:03:17 PST
Size:
4.46 KB
patch
obsolete
>Subversion Revision: 240159 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 89c045b2ec670720d7cca6f8bf077134a992268b..4e382bd0cf07dd25041ad7f00ae1405be82d4e71 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-18 Youenn Fablet <youenn@apple.com> >+ >+ getUserMedia with a deviceId exact constraint with an empty string value should succeed >+ https://bugs.webkit.org/show_bug.cgi?id=193541 >+ <rdar://problem/47357218> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If there is a deviceId constraint, remove any empty string from ideal/exact string list. >+ This will make the device selection be solely based on other constraints. >+ An improvement might be for 'exact' constraint to pick the default device. >+ There is currently no such notion of a default device. >+ Picking the best fitting device seems a good tradeoff. >+ Covered by updated test. >+ >+ * platform/mediastream/MediaConstraints.cpp: >+ (WebCore::MediaTrackConstraintSetMap::set): >+ * platform/mediastream/MediaConstraints.h: >+ (WebCore::StringConstraint::removeEmptyStringConstraint): >+ > 2019-01-18 Ali Juma <ajuma@chromium.org> > > FetchResponse::url should return the empty string for tainted responses >diff --git a/Source/WebCore/platform/mediastream/MediaConstraints.cpp b/Source/WebCore/platform/mediastream/MediaConstraints.cpp >index 93f671cfcc95b623e5a8ad800615f6ac2baa50ef..60dea71a2f99b518033e1e81d1d8827ea86b5ed3 100644 >--- a/Source/WebCore/platform/mediastream/MediaConstraints.cpp >+++ b/Source/WebCore/platform/mediastream/MediaConstraints.cpp >@@ -315,6 +315,8 @@ void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, Optiona > m_facingMode = WTFMove(constraint); > break; > case MediaConstraintType::DeviceId: >+ if (constraint) >+ constraint->removeEmptyStringConstraint(); > m_deviceId = WTFMove(constraint); > break; > case MediaConstraintType::GroupId: >diff --git a/Source/WebCore/platform/mediastream/MediaConstraints.h b/Source/WebCore/platform/mediastream/MediaConstraints.h >index d6e4a867ff47b32413daaba5ab53ae7926c28d9c..69689cfdc25eac31ff211a180c3e3c671892758a 100644 >--- a/Source/WebCore/platform/mediastream/MediaConstraints.h >+++ b/Source/WebCore/platform/mediastream/MediaConstraints.h >@@ -610,6 +610,16 @@ public: > return true; > } > >+ void removeEmptyStringConstraint() >+ { >+ m_exact.removeAllMatching([](auto& constraint) { >+ return constraint.isEmpty(); >+ }); >+ m_ideal.removeAllMatching([](auto& constraint) { >+ return constraint.isEmpty(); >+ }); >+ } >+ > private: > Vector<String> m_exact; > Vector<String> m_ideal; >diff --git a/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt b/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt >index 098a81214214cdfc79329d6122c07ea1d4a8c8f3..6831a167d9a4a0019d6c2251029610c8752bba2d 100644 >--- a/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt >+++ b/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt >@@ -3,4 +3,5 @@ PASS Device IDs should be empty initially > PASS Collect device IDs > PASS Pass device IDs as exact constraints > PASS Pass device IDs as optional constraints >+PASS Exact device IDs with special values: empty string, null, undefined > >diff --git a/LayoutTests/fast/mediastream/get-user-media-device-id.html b/LayoutTests/fast/mediastream/get-user-media-device-id.html >index cc6f0ee8d007c3b14978ce5ef84381213c87193c..d02069fec7a2e143a04e7d1b8aa46a9d4a701e68 100644 >--- a/LayoutTests/fast/mediastream/get-user-media-device-id.html >+++ b/LayoutTests/fast/mediastream/get-user-media-device-id.html >@@ -70,6 +70,15 @@ > > }, "Pass device IDs as optional constraints"); > >+ promise_test(async (test) => { >+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: ""}}}); >+ await navigator.mediaDevices.getUserMedia({ video: {deviceId: {exact: [""]}}}); >+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: undefined}}}); >+ >+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: null}}}).then(assert_unreached, () => { }); >+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: "test"}}}).then(assert_unreached, () => { }); >+ }, "Exact device IDs with special values: empty string, null, undefined"); >+ > </script> > </head> > <body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193541
: 359558