Open ShijunS opened 8 years ago
BluetoothDevice
object doesn't mean the device is in range, and you can get NetworkError
s when trying to reconnect to it.PermissionStatus
.query()
should always return "prompt"
, because any request for the feature will prompt the user. Once Firefox's https://bugzilla.mozilla.org/show_bug.cgi?id=1270572 is implemented, then query()
should probably return "granted"
while a stream is open, and switch that to "prompt"
when the stream is closed. I won't argue that this permission model makes sense, but I do think query()
can accurately represent it.query()
in realm A should initially return "prompt"
. If the user grants permission, query()
should switch to returning "granted"
in realm A, but stay with "prompt"
in realm B. If the tab holding realm A is reloaded, which leads to it holding realm C, then realm C's query()
should return "prompt"
. Does that make sense? https://github.com/w3c/permissions/pull/114 makes this a little more explicit, but nobody's reviewed it yet.query()
prompt by default to address this, but I'm not certain of that for either browser. There might be a browser-wide setting to turn on such prompts.It also makes sense to fix the spec and/or add examples to clarify all of this. I'll get around to that eventually based on just the questions here, but would love pull requests or pointers to particular places in the spec that need improvements.
Note that with http
, Edge appears to use the same "ephemeral" model used by Firefox. FWIW this behavior is (or at least was) mandated by the mediacapture spec, so Edge's https
behavior here might be considered non-compliant. @ShijunS thoughts?
@jyasskin, thanks for the detailed feedback! It seems issue #52 could be a blocking factor if not resolved.
A couple quick notes to facilitate further discussions
@jan-ivar is correct about the Edge http model. The https model is still evolving, so a work-in-progress.
For case 1, in the "per-realm" model, if https://example.com/ is granted access to device "abcd"
, "abcd"
is disconnected, and the UA knows that it will get a new deviceId if it's plugged in again, then
"prompt"
or "granted"
from query()
after "abcd"
is disconnected, the page won't actually be able to access the device, so to some extent it doesn't matter."abcd"
will never appear again, you might be able to let the page save some resources by changing "abcd"
's state back to the default (probably "prompt"
).If the UA doesn't know that the physical device will get a new deviceId, you probably have to leave the device as "granted"
just in case.
In "ephemeral" mode, you'd revoke as soon as all active streams stop, which I assume happens automatically when the device is disconnected.
Here are some questions on the query() method - some might just be implementation issues, while others might need further consideration in the spec. @jyasskin, it'd be nice to know your takes on them.
BTW, is there any security concern for apps to silently detect a granted permission - especially any per-use or short-term permissions? Meanwhile, it'd be quite awkward if query() triggers a permission UI to allow the page to query. I expect the security experts here must have given thoughts on this one already, wonder if anyone could point me to discussions in the mailing list or github.