Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposed change for #402 #407

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 60 additions & 28 deletions getusermedia.html
Original file line number Diff line number Diff line change
Expand Up @@ -2895,10 +2895,16 @@ <h3>MediaDevices</h3>
<li>
<p>On the <a href=
"https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-global">
relevant global object</a>, create three internal slots:
[[\devicesLiveMap]], [[\devicesAccessibleMap]], and
[[\kindsAccessibleMap]], each initialized to a different empty object.
</p>
relevant global object</a>, run the following steps:</p>
<ol>
<li>
<p>Create three internal slots: [[\devicesLiveMap]], [[\devicesAccessibleMap]], and
[[\kindsAccessibleMap]], each initialized to a different empty object.</p>
</li>
<li>
<p>Create one internal slot: [[\storedDeviceList]], initialized to null.</p>
</li>
</ol>
</li>
<li>
<p>For each kind of device, <var>kind</var>, that
Expand Down Expand Up @@ -2956,14 +2962,25 @@ <h3>MediaDevices</h3>
</li>
Copy link
Member

@jan-ivar jan-ivar Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes all permission requirements for the devicechange event, which I don't think we agreed to.

I think we need to keep this, and an exception for the active tab that has input focus. Something like:

", or the active document in the current browsing context is fully active and has focus, then"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jan-ivar, I'll update this part based on your input.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still haven't figured out a situation where protecting the devicechange event gives any real protection (see previous discussion). Until I see such a scenario, I am in favor of removing all coupling between the devicechange event and the deviceinfo permission.

Copy link
Member

@jan-ivar jan-ivar Oct 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvestrand arguing for going further than this PR, is not a reason to hold up this PR I think.

This PR removes permission for the active tab and aligns enumerateDevices with the firing of the event, like we do with other events.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvestrand I would be against going further. If I have, say, 100 tabs open across 3 separate brand browsers, and pull out my USB device, and we signal all tabs about that immediately, that's a fairly strong timing signal to all those tabs' JS that I might be the same user, in spite of every other precaution I might have taken to be anonymous (including using separate browsers, VPNs, denying cookies, and any tracking-protecting private browsing modes).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should add virtual machines to that list, if they have USB hooked up.

</ol>

<p>When new media input and/or output devices are made available, and if either the
<a data-lt="retrieve the permission state">permission state</a> of the
"list-devices" permission is "granted" or any of the local devices are
attached to an active MediaStream in the current browsing context, then
the User Agent MUST queue a task
that fires a simple event named <code><a href=
"#event-mediadevices-devicechange">devicechange</a></code> at the
<code><a>MediaDevices</a></code> object. The User Agent MAY fire just a
<p>When new media input and/or output devices are made available, if either the
<a data-lt="retrieve the permission state">permission state</a> of the
"device-info" permission is "granted", or any of the local devices are
attached to an active MediaStream in the current browsing context,
or the <a href="https://html.spec.whatwg.org/multipage/browsers.html#active-document">active document</a>
in the current browsing context is <a href="https://html.spec.whatwg.org/multipage/browsers.html#fully-active">fully active</a>
and <a href="https://html.spec.whatwg.org/#gains-focus">has focus</a>, then
the User Agent MUST run the following steps:</p>
<ol>
<li>
<p>Set [[\storedDeviceList]] to null.</p>
</li>
<li>
<p>Queue a task that fires a simple event named <code><a href=
"#event-mediadevices-devicechange">devicechange</a></code> at the
<code><a>MediaDevices</a></code> object.</p>
</li>
</ol>
<p>The User Agent MAY fire just a
single event when several devices are added at the same time, e.g. a
camera with a microphone. These events are potentially
triggered simultaneously across browsing contexts on different origins;
Expand Down Expand Up @@ -3017,6 +3034,11 @@ <h2>Methods</h2>
<li>
<p>Run the following steps in parallel:</p>
<ol>
<li>
<p>If [[\storedDeviceList]] is not null, then let <var>resultList</var>
be a copy of [[\storedDeviceList]], and jump to the step labeled
<em>Complete Enumeration</em>.</p>
</li>
<li>
<p>Let <var>resultList</var> be an empty list.</p>
</li>
Expand Down Expand Up @@ -3076,25 +3098,35 @@ <h2>Methods</h2>
</li>
</ol>
</li>
<li>If any of the local devices are attached to a
<code>live</code> MediaStreamTrack in the current browsing
context, set <var>list-permission</var> to "granted".</li>
<li>If no such device is attached, <a>retrieve the
permission state</a> of the "list-devices" permission, and
assign it to <var>list-permission</var>.
</li>
<li>
<p>If <var>list-permission</var> is not "granted", let
<var>filteredList</var> be a copy of
<var>resultList</var>, and all its elements, where the
<code><a data-link-for="MediaDeviceInfo">label</a></code>
member is the empty string.</p>
<p>Set [[\storedDeviceList]] to <var>resultList</var>.</p>
</li>
<li>
<p>If <var>filteredList</var> is a non-empty list, then
resolve <var>p</var> with <var>filteredList</var>.
Otherwise, resolve <var>p</var> with
<var>resultList</var>.</p>
<p><em>Complete Enumeration</em>: run the following sub steps to
resolve <var>p</var>:</p>
<ol>
<li>
<p>If any of the local devices are attached to a
<code>live</code> MediaStreamTrack in the current browsing
context, set <var>list-permission</var> to "granted",
otherwise set <var>list-permission</var> to the result of
<a data-lt="retrieve the permission state"> retrieving the
permission state</a> of the "device-info" permission.</p>
</li>
<li>
<p>If <var>list-permission</var> is not "granted", let
<var>filteredList</var> be a copy of
<var>resultList</var>, and all its elements, where the
<code><a data-link-for="MediaDeviceInfo">label</a></code>
member is the empty string.</p>
</li>
<li>
<p>If <var>filteredList</var> is a non-empty list, then
resolve <var>p</var> with <var>filteredList</var>.
Otherwise, resolve <var>p</var> with
<var>resultList</var>.</p>
</li>
</ol>
</li>
</ol>
</li>
Expand Down