diff --git a/index.bs b/index.bs index fb83dde..eefcdc6 100644 --- a/index.bs +++ b/index.bs @@ -123,6 +123,7 @@ spec: fingerprinting-guidance text: fingerprinting surface spec: html type: dfn + text: associated navigator; for: / text: browsing context; for: / text: global object; for: / text: navigable; for: / @@ -559,8 +560,8 @@ that UAs will choose not to prompt. Bluetooth includes ServiceEventHandlers; -Methods on this interface typically complete asynchronously, queuing work on -the bluetooth task source. +Methods defined in this specification typically complete asynchronously, queuing +work on the Bluetooth task source.
|storage|.{{BluetoothPermissionStorage/allowedDevices}}
,
add the {{BluetoothDevice}} object representing
|allowedDevice|@{{[[device]]}} to |devices|.
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to [=resolve=] |promise| with |devices|.
requestDevice(options)
passing
|options|.{{RequestDeviceOptions/optionalManufacturerData}}
,
and let |devices| be the result.
- 1. [=Queue a global task=] on [=this=]'s [=relevant global object=] using
- the [=bluetooth task source=] to run the following steps:
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given [=this=]'s
+ [=relevant global object=] to run the following steps:
1. If the previous step threw an exception, [=reject=] |promise| with that
exception and abort these steps.
1. If |devices| is an empty sequence, [=reject=] |promise| with a
@@ -2003,10 +2004,12 @@ The getAvailability()
method,
when invoked, MUST return a new promise |promise| and run the following
steps in parallel:
-1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not
- [=allowed to use=] the [=policy-controlled feature=] named
- "[=policy-controlled feature/bluetooth=]", queue a task to
- resolve |promise| with `false`, and abort these steps.
+1. Let |global| be [=this=]'s [=relevant global object=].
+1. If |global|'s [=associated Document=] is not [=allowed to use=] the
+ [=policy-controlled feature=] named
+ "[=policy-controlled feature/bluetooth=]", [=queue a global task=] on
+ the [=Bluetooth task source=] given |global| to [=resolve=] |promise|
+ with `false`, and abort these steps.
1. If the user has configured the UA to return a
particular answer from this function for the current origin, queue a
task to resolve |promise| with the configured answer, and abort
@@ -2020,14 +2023,19 @@ steps in parallel:
1. Let |simulatedBluetoothAdapter| be [=this=]'s [=Window/navigable=]'s
[=navigable/top-level traversable=]'s simulated Bluetooth adapter.
1. If |simulatedBluetoothAdapter| is not empty,
- 1. If |simulatedBluetoothAdapter|'s [=adapter state=] is "absent", [=queue a task=] to [=resolve=] |promise| with `false`.
- 1. Otherwise, [=queue a task=] to [=resolve=] |promise| with `true`.
+ 1. If |simulatedBluetoothAdapter|'s [=adapter state=] is "absent", [=queue
+ a global task=] on the [=Bluetooth task source=] given |global| to
+ [=resolve=] |promise| with `false`.
+ 1. Otherwise, [=queue a global task=] on the [=Bluetooth task source=]
+ given |global| to [=resolve=] |promise| with `true`.
1. Abort these steps.
-1. If the UA is running on a system that has a Bluetooth radio queue a
- task to resolve |promise| with `true` regardless of the powered
- state of the Bluetooth radio.
-1. Otherwise, queue a task to resolve |promise| with `false`.
+1. If the UA is running on a system that has a Bluetooth radio [=queue a global
+ task=] on the [=Bluetooth task source=] given |global| to [=resolve=]
+ |promise| with `true` regardless of the powered state of the Bluetooth
+ radio.
+1. Otherwise, [=queue a global task=] on the [=Bluetooth task source=] given
+ |global| to [=resolve=] |promise| with `false`.
Note: The promise is resolved in parallel to let the UA call out to
@@ -2066,17 +2074,20 @@ navigator.permissions.query({name: "bl
If the UA becomes able or unable to use Bluetooth, for example because a radio
was physically attached or detached, or the user has changed their configuration for the answer returned from
-{{getAvailability()}}, the UA must queue a task on each global
-object |global|'s responsible event loop to run the following steps:
+{{getAvailability()}}, the UA must [=queue a global task=] on the [=Bluetooth
+task source=] given each [=global object=] |global| to run the following steps:
1. Let |oldAvailability| be the value {{getAvailability()}} would have returned
before the change.
1. Let |newAvailability| be the value {{getAvailability()}} would return after
the change.
-1. If |oldAvailability| is not the same as |newAvailability|, fire an
- event named {{availabilitychanged}} using the {{ValueEvent}} interface
- at |global|.navigator.bluetooth
with its {{ValueEvent/value}}
- attribute initialized to |newAvailability|.
+1. If |oldAvailability| is not the same as |newAvailability|,
+ 1. Let |navigator| be |global|'s associated Navigator
.
+ 1. Let |bluetooth| be |navigator|'s associated
+ Bluetooth
.
+ 1. [=Fire an event=] named {{availabilitychanged}} using the {{ValueEvent}}
+ interface at |bluetooth| with its {{ValueEvent/value}} attribute
+ initialized to |newAvailability|.
@@ -2335,6 +2346,7 @@ The watchAdvertisements(|options|)
method, when invoked, MUST return a new promise |promise| and
run the following steps:
+1. Let |global| be the [=relevant global object=] of [=this=].
1. If |options|.{{AbortSignal|signal}}
is present, then perform
the following sub-steps:
1. If |options|.{{AbortSignal|signal}}
is
@@ -2357,8 +2369,9 @@ run the following steps:
1. Ensure that the UA is scanning for this device's
advertisements. The UA SHOULD NOT filter out "duplicate"
advertisements for the same device.
- 1. If the UA fails to enable scanning, [=queue a task=] to
- perform the following steps, and abort these steps:
+ 1. If the UA fails to enable scanning, [=queue a global task=]
+ on the [=Bluetooth task source=] given |global| to perform
+ the following steps, and abort these steps:
1. Set this.{{[[watchAdvertisementsState]]}}
to
`'not-watching'`.
1. [=Reject=] |promise| with one of the following errors:
@@ -2372,9 +2385,10 @@ run the following steps:
:: {{UnknownError}}
- 1. [=Queue a task=] to perform the following steps, but [=abort
- when=] this.{{[[watchAdvertisementsState]]}}
- becomes `not-watching`:
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given
+ |global| to perform the following steps, but [=abort when=]
+ this.{{[[watchAdvertisementsState]]}}
becomes
+ `not-watching`:
1. Set this.{{[[watchAdvertisementsState]]}}
to
`watching`.
1. Set this.{{watchingAdvertisements}}
to `true`.
@@ -2413,12 +2427,11 @@ To abort {{BluetoothDevice/watchAdvertisements}} for a
To abort all active {{BluetoothDevice/watchAdvertisements}}
-operations, run these steps:
+operations given a {{Bluetooth}} |bluetooth|, run these steps:
-1. [=map/For each=] |device|
in
- {{Bluetooth}}.{{[[deviceInstanceMap]]}}
, perform the
- following steps:
- 1. If |device|.{{[[watchAdvertisementsState]]}}
is
+1. [=map/For each=] |device| in
+ |bluetooth|.{{[[deviceInstanceMap]]}}, perform the following steps:
+ 1. If |device|.{{[[watchAdvertisementsState]]}} is
`pending-watch` or `watching`, run [=abort watchAdvertisements=]
with |device|.
@@ -2433,16 +2446,17 @@ Operations that initiate a scan for Bluetooth devices may only run in a visible
aborted.
-When the user agent determines that the [=document visibility state|visibility
-state=] of the associated Document
of the
-[=current settings object=]'s [=relevant global object=] changes, it must run
-these steps:
-
-1. Let |document|
be the associated Document
of
- the [=current settings object=]'s [=relevant global object=].
-1. If |document|
's [=document visibility state|visibility state=]
- is not "visible"
, then [=abort all active watchAdvertisements=]
- operations.
+This specification defines the following [=page visibility change steps=] given
+|visibilityState| and |document|:
+
+1. Let |global| be |document|'s [=relevant global object=].
+1. [=Queue a global task=] on the [=Bluetooth task source=] given |global| to
+ perform the following steps:
+ 1. Let |navigator| be |global|'s associated Navigator
.
+ 1. Let |bluetooth| be |navigator|'s associated
+ Bluetooth
.
+ 1. If |visibilityState| is not "visible"
, then [=abort all
+ active watchAdvertisements=] operations on |bluetooth|.
@@ -2455,11 +2469,17 @@ active=] [=document=]. When [=fully active|full activity=] is lost, scanning
operations for that [=document=] need to be aborted.
-When the user agent determines that a associated Document
of
-the [=current settings object=]'s [=relevant global object=] is no longer
-[=fully active=], it must run these steps:
-
-1. Run [=abort all active watchAdvertisements=] operations.
+When the user agent determines that a {{Document}} is no longer [=fully
+active=], it must run these steps:
+
+1. Let |document| be the {{Document}} that is no longer [=fully active=].
+1. Let |global| be |document|'s [=relevant global object=].
+1. [=Queue a global task=] on the [=Bluetooth task source=] given |global| to
+ perform the following steps:
+ 1. Let |navigator| be |global|'s associated Navigator
.
+ 1. Let |bluetooth| be |navigator|'s associated
+ Bluetooth
.
+ 1. Run [=abort all active watchAdvertisements=] operations on |bluetooth|.
Promise<BluetoothGATT*>
instance associated with |entry| in
|context|.{{Bluetooth/[[attributeInstanceMap]]}}.
-1. [=Queue a global task=] on |global| using the [=bluetooth task source=] to
+1. [=Queue a global task=] on the [=Bluetooth task source=] given |global| to
[=resolve=] |promise| with the result of [=waiting for all=] elements of
|result|.
@@ -3121,11 +3141,11 @@ method, when invoked, MUST perform the following steps:
BluetoothDevice
representing the device in
which |service| appears, and let |device| be the result.
- 1. If the previous step threw an error, [=queue a global task=] on |global|
- using the [=bluetooth task source=] to [=reject=] |promise| with
+ 1. If the previous step threw an error, [=queue a global task=] on the
+ [=Bluetooth task source=] given |global| to [=reject=] |promise| with
that error and abort these steps.
1. Initialize |result|.{{BluetoothRemoteGATTService/device}} from |device|.
1. Initialize |result|.{{BluetoothRemoteGATTService/uuid}} from the UUID of
@@ -3347,7 +3367,7 @@ Service service, the UA must run the following steps:
|result|.{{BluetoothRemoteGATTService/isPrimary}} to `true`. Otherwise,
initialize |result|.{{BluetoothRemoteGATTService/isPrimary}} to
`false`.
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to [=resolve=] |promise| with |result|.
1. Return |promise|.
@@ -3486,8 +3506,8 @@ run the following steps:
|characteristic|.
1. Create a BluetoothCharacteristicProperties
instance from the
Characteristic |characteristic|, and let |properties| be the result.
- 1. If the previous step returned an error, [=queue a global task=] on |global|
- using the [=bluetooth task source=] to [=reject=] |promise| with
+ 1. If the previous step returned an error, [=queue a global task=] on the
+ [=Bluetooth task source=] given |global| to [=reject=] |promise| with
that error and abort these steps.
1. Initialize |result|.{{BluetoothRemoteGATTCharacteristic/properties}} to
|properties|.
@@ -3496,7 +3516,7 @@ run the following steps:
|result|.{{BluetoothRemoteGATTCharacteristic/value}} to a [=new=]
{{DataView}} wrapping a [=new=] {{ArrayBuffer}} containing the most
recently read value from |characteristic| if this value is available.
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to [=resolve=] |promise| with |result|.
1. Return |promise|.
@@ -3547,11 +3567,11 @@ The readValue()
|promise| and run the following steps [=in parallel=]:
1. If the Read
bit is not set in |characteristic|'s
properties, [=queue a global
- task=] on |global| using the [=bluetooth task source=] to [=reject=]
+ task=] on the [=Bluetooth task source=] given |global| to [=reject=]
|promise| with a "{{NotSupportedError}}" {{DOMException}} and abort
these steps.
1. If the UA is currently using the Bluetooth system, it MAY [=queue a
- global task=] on |global| using the [=bluetooth task source=] to
+ global task=] on the [=Bluetooth task source=] given |global| to
[=reject=] |promise| with a "{{NetworkError}}" {{DOMException}} and
abort these steps.
@@ -3561,7 +3581,7 @@ The readValue()
1. Use any combination of the sub-procedures in the [=Characteristic Value
Read=] procedure to retrieve the value of |characteristic|.
Handle errors as described in .
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to perform the following steps:
1. If |promise| is not in |gatt|.{{[[activeAlgorithms]]}}, [=reject=]
|promise| with a "{{NetworkError}}" {{DOMException}} and abort
@@ -3605,7 +3625,7 @@ the UA MUST perform the following steps:
|promise| and run the following steps [=in parallel=].
1. Assert: |response| is one of "required", "never", or "optional".
1. If the UA is currently using the Bluetooth system, it MAY [=queue a
- global task=] on |global| using the [=bluetooth task source=] to
+ global task=] on the [=Bluetooth task source=] given |global| to
[=reject=] |promise| with a "{{NetworkError}}" {{DOMException}} and
abort these steps.
@@ -3631,7 +3651,7 @@ the UA MUST perform the following steps:
Handle errors as described in .
- 1. Queue a global task using |global| on the [=bluetooth task
+ 1. Queue a global task on |global| using the [=Bluetooth task
source=] to perform the following steps:
1. If |promise| is not in |gatt|.{{[[activeAlgorithms]]}}, [=reject=]
|promise| with a "{{NetworkError}}" {{DOMException}} and abort
@@ -3718,17 +3738,17 @@ notifications.
|promise| and run the following steps [=in parallel=].
1. If neither of the Notify
or Indicate
bits are set
in |characteristic|'s properties,
- [=queue a global task=] on |global| using the [=bluetooth task source=]
+ [=queue a global task=] on the [=Bluetooth task source=] given |global|
to [=reject=] |promise| with a {{NotSupportedError}} and abort these
steps.
1. If |characteristic|'s [=active notification context set=] contains
{{Navigator/bluetooth|navigator.bluetooth}}, [=queue a global task=]
- using the [=bluetooth task source=] to [=resolve=] |promise| with
- [=this=] and abort these steps.
+ on the [=Bluetooth task source=] given |global| to [=resolve=]
+ |promise| with [=this=] and abort these steps.
1. If the UA is currently using the Bluetooth system, it MAY [=queue a
- global task=] using the [=bluetooth task source=] to [=reject=]
- |promise| with a "{{NetworkError}}" {{DOMException}} and abort these
- steps.
+ global task=] on the [=Bluetooth task source=] given |global| to
+ [=reject=] |promise| with a "{{NetworkError}}" {{DOMException}} and
+ abort these steps.
Issue(188): Implementations may be able to avoid this {{NetworkError}}, but
for now sites need to serialize their use of this API and/or give the user a
@@ -3753,7 +3773,7 @@ notifications.
1. If the procedures were successful,
{{Navigator/bluetooth|navigator.bluetooth}} to
|characteristic|'s [=active notification context set=].
- 1. [=Queue a global task=] using |global| on the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to perform the following steps:
1. If |promise| is not in |gatt|.{{[[activeAlgorithms]]}}, [=reject=]
|promise| with a "{{NetworkError}}" {{DOMException}} and abort
@@ -3787,7 +3807,8 @@ promise promise and run the following steps in parallel:
Descriptors procedures to clear the Notification
and
Indication
bits in characteristic's Client
Characteristic Configuration descriptor.
-1. Queue a task to resolve promise with `this`.
+1. [=Queue a global task=] on the [=Bluetooth task source=] given [=this=]'s
+ [=relevant global object=] to [=resolve=] |promise| with [=this=].
Note: Queuing a task to resolve the promise ensures that no
@@ -3951,8 +3972,9 @@ the UA MUST run the following steps.
a [=new=] {{DataView}} wrapping a [=new=] {{ArrayBuffer}} containing
the most recently read value from |descriptor| if this value is
available.
- 1. [=Queue a global task=] using [=this=]'s [=relevant global object=] to
- [=resolve=] |promise| with |result|.
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given
+ [=this=]'s [=relevant global object=] to [=resolve=] |promise| with
+ |result|.
1. Return |promise|.
@@ -3974,7 +3996,7 @@ readValue()
method, when invoked, MUST run the following steps:
1. Return a |gatt|-[=connection-checking wrapper=] around [=a new promise=]
|promise| and run the following steps [=in parallel=]:
1. If the UA is currently using the Bluetooth system, it MAY [=queue a
- global task=] on |global| using the [=bluetooth task source=] to
+ global task=] on the [=Bluetooth task source=] given |global| to
[=reject=] |promise| with a "{{NetworkError}}" {{DOMException}} and
abort these steps.
@@ -3985,7 +4007,7 @@ readValue()
method, when invoked, MUST run the following steps:
Characteristic Descriptors=] sub-procedure to retrieve the value of
|descriptor|. Handle errors as described in
.
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to perform the following steps:
1. If |promise| is not in |gatt|.{{[[activeAlgorithms]]}}, [=reject=]
|promise| with a "{{NetworkError}}" {{DOMException}} and abort
@@ -4022,7 +4044,7 @@ following steps:
1. Return a |gatt|-[=connection-checking wrapper=] around [=a new promise=]
|promise| and run the following steps [=in parallel=].
1. If the UA is currently using the Bluetooth system, it MAY [=queue a
- global task=] on |global| using the [=bluetooth task source=] to
+ global task=] on the [=Bluetooth task source=] given |global| to
[=reject=] |promise| with a "{{NetworkError}}" {{DOMException}} and
abort these steps.
@@ -4033,7 +4055,7 @@ following steps:
Characteristic Descriptors=] sub-procedure to write |bytes| to
|descriptor|. Handle errors as described in
.
- 1. [=Queue a global task=] on |global| using the [=bluetooth task source=]
+ 1. [=Queue a global task=] on the [=Bluetooth task source=] given |global|
to perform the following steps:
1. If |promise| is not in |gatt|.{{[[activeAlgorithms]]}}, [=reject=]
|promise| with a "{{NetworkError}}" {{DOMException}} and abort
@@ -4162,8 +4184,8 @@ interface participate in a tree.
When a Bluetooth device device's ATT Bearer is lost
(e.g. because the remote device moved out of range or the user used a platform
feature to disconnect it), for each {{BluetoothDevice}} deviceObj the
-UA MUST queue a task on deviceObj's relevant settings
-object's responsible event loop to perform the following steps:
+UA MUST [=queue a global task=] on the [=Bluetooth task source=] given
+|deviceObj|'s [=relevant global object=] to perform the following steps:
1. If deviceObj.{{BluetoothDevice/[[representedDevice]]}}
is not the same device as device, abort these steps.
@@ -4221,9 +4243,9 @@ When the UA receives a Bluetooth Characteristic Value Notification
or Indication,
it must perform the following steps:
-1. For each bluetoothGlobal in the Characteristic's active
- notification context set, queue a task on the event loop of the
- script settings object of bluetoothGlobal to do the following
+1. For each |bluetoothGlobal| in the Characteristic's [=active notification
+ context set=], [=queue a global task=] on the [=Bluetooth task source=]
+ given |bluetoothGlobal|'s [=relevant global object=] to do the following
sub-steps:
1. Let characteristicObject be the
{{BluetoothRemoteGATTCharacteristic}} in the Bluetooth tree
@@ -4396,9 +4418,9 @@ Changed characteristic, it MUST perform the following steps.
1. Let changedDevices be the set of Bluetooth devices that
contain any Service in removedAttributes,
addedAttributes, and changedServices.
-1. For each {{BluetoothDevice}} deviceObj that is connected to a
- device in changedDevices, queue a task on its relevant
- global object's responsible event loop to do the following steps:
+1. For each {{BluetoothDevice}} |deviceObj| that is connected to a device in
+ |changedDevices|, [=queue a global task=] on the [=Bluetooth task source=]
+ given |deviceObj|'s [=relevant global object=] to do the following steps:
1. For each Service service in
removedAttributes:
1. If deviceObj.{{BluetoothDevice/[[allowedServices]]}}
@@ -4915,9 +4937,13 @@ if the following steps return `blocked`:
};
-Each {{Navigator}} has an associated `Bluetooth`, which is a {{Bluetooth}} object. Upon creation of the {{Navigator}} object, its associated `Bluetooth` must be set to a new {{Bluetooth}} object created in the {{Navigator}} object's [=relevant realm=].
+Each {{Navigator}} has an associated `Bluetooth`, which is a
+{{Bluetooth}} object. Upon creation of the {{Navigator}} object, its
+associated `Bluetooth` must be set to a new {{Bluetooth}} object
+created in the {{Navigator}} object's [=relevant realm=].
-{{Navigator}}'s bluetooth getter steps are to return [=this=]'s associated `Bluetooth`.
+{{Navigator}}'s bluetooth getter
+steps are to return [=this=]'s associated `Bluetooth`.
# Integrations # {#integrations}