Re: [web-bluetooth] Clarify undocumented behaviors

1. If there's no Bluetooth adapter, then [scan for 
devices](https://webbluetoothcg.github.io/web-bluetooth/#scan-for-devices)
 does nothing in steps 3 and 4, and winds up returning an empty list. 
Then [request Bluetooth 
devices](https://webbluetoothcg.github.io/web-bluetooth/#requestDevice-prompt)
 prompts the user to choose one of an empty set of devices, and since 
there aren't any devices, the user can't pick any, and must cancel, 
resulting in an empty list. Chrome [short-circuits the 
prompt](https://cs.chromium.org/chromium/src/content/browser/bluetooth/web_bluetooth_service_impl.cc?l=339),
 since it already knows the answer. 
[`requestDevice()`](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice)
 turns the empty list of results into a `NotFoundError`.<br>
We just specified an 
[API](https://webbluetoothcg.github.io/web-bluetooth/#availability) to
 explicitly check if there's an adapter, so pages can avoid showing UI
 that doesn't make sense without any Bluetooth support.
2. I assume you mean that a filter for an advertised name demands a 
name longer than 29 bytes. In that case, [request bluetooth 
devices](https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices)
 says to throw a `TypeError` if it's longer than 248 bytes, but leaves
 it alone if it's a length that can't currently be advertised. The 
rest of the sequence is the same as above: you get an empty set of 
devices since no advertisement can currently include a name longer 
than 29 bytes, meaning the user has to cancel the chooser, leading to 
a `NotFoundError`. If Bluetooth 5 increases the advertising limit, 
longer names could start working without any change to the spec.

So, I think Chrome's behavior is closer to the spec here, although we 
could definitely change the spec if there's a reason to prefer Servo's
 behavior.

-- 
GitHub Notification of comment by jyasskin
Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/296#issuecomment-248133582
 using your GitHub account

Received on Monday, 19 September 2016 21:32:06 UTC