-
Notifications
You must be signed in to change notification settings - Fork 188
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
Use sequence instead of map for data filters #545
Conversation
02ba744
to
3e350a0
Compare
Note that CI should succeed once #546 is merged. |
3e350a0
to
e3139c1
Compare
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
index.bs
Outdated
1. Let |canonicalizedDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |dataFilter|, | ||
present and | ||
<code>|filter|.{{BluetoothLEScanFilterInit/manufacturerData}}.length === 0</code>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit, as was pointed out to me on the most recent specifications I worked on, the correct syntax for referring to a member of a dictionary is filter["manufacturerData"]
rather than filter.manufacturerData
. We should do a pass to fix this over the whole specification but might as well avoid introducing new examples of the old style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
[ | ||
{ | ||
manufacturerData: [ | ||
{ companyIdentifier: 17, dataPrefix: new Uint8Array([1, 2, 3]) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put companyIdentifier
and dataPrefix
on separate lines in this and the next two examples to avoid this table column becoming too wide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
1. For each |manufacturerData| in | ||
<code>|filter|.{{BluetoothLEScanFilterInit/manufacturerData}}</code>, do the following sub-steps: | ||
1. If <code>|manufacturerData|.{{BluetoothManufacturerDataFilterInit/companyIdentifier}}</code> | ||
is present in |canonicalizedFilter|.manufacturerData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably be more specific about what "present" means here. Something like, "If there exists a object |existing| in |canonicalizedFilter|["manufacturerData"] where |existing|["companyIdentifier"] === |manufacturerData|["companyIdentifier"], throw..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
is present in |canonicalizedFilter|.manufacturerData, | ||
throw a {{TypeError}} and abort these steps. | ||
1. Let |canonicalizedManufacturerDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |manufacturerData|, | ||
<a>converted to an ECMAScript value</a>. If this throws an exception, | ||
propagate that exception and abort these steps. | ||
1. Call <a abstract-op>CreateDataProperty</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since canonicalizedFilter["manufacturerData"]
is now a sequence rather than an object we can append to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
@@ -1400,51 +1431,42 @@ returned from the following steps: | |||
<code><var>filter</var>.namePrefix</code>. | |||
1. Set <code>|canonicalizedFilter|.manufacturerData</code> to `{}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize canonicalizedFilter["manufacturerData"]
to an empty array rather than an empty object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
|canonicalizedDataFilter|). | ||
(|canonicalizedFilter|.manufacturerData, | ||
<code>|manufacturerData|.{{BluetoothManufacturerDataFilterInit/companyIdentifier}}</code>, | ||
|canonicalizedManufacturerDataFilter|). | ||
1. Set <code>|canonicalizedFilter|.serviceData</code> to `{}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
1. Let |canonicalizedDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |dataFilter|, | ||
1. Let |canonicalizedServiceDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |serviceData|, | ||
<a>converted to an ECMAScript value</a>. If this throws an exception, | ||
propagate that exception and abort these steps. | ||
1. Call <a | ||
abstract-op>CreateDataProperty</a>(|canonicalizedFilter|.serviceData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scanning.bs
Outdated
spec: permissions-1 | ||
type: enum-value | ||
text: "bluetooth" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #546 you only removed the conflicting enum value above. Is this change also necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not anymore. Thanks for catching!
e3139c1
to
509e088
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
index.bs
Outdated
[ | ||
{ | ||
manufacturerData: [ | ||
{ companyIdentifier: 17, dataPrefix: new Uint8Array([1, 2, 3]) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
1. Let |canonicalizedDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |dataFilter|, | ||
present and | ||
<code>|filter|.{{BluetoothLEScanFilterInit/manufacturerData}}.length === 0</code>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
1. For each |manufacturerData| in | ||
<code>|filter|.{{BluetoothLEScanFilterInit/manufacturerData}}</code>, do the following sub-steps: | ||
1. If <code>|manufacturerData|.{{BluetoothManufacturerDataFilterInit/companyIdentifier}}</code> | ||
is present in |canonicalizedFilter|.manufacturerData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scanning.bs
Outdated
spec: permissions-1 | ||
type: enum-value | ||
text: "bluetooth" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not anymore. Thanks for catching!
index.bs
Outdated
is present in |canonicalizedFilter|.manufacturerData, | ||
throw a {{TypeError}} and abort these steps. | ||
1. Let |canonicalizedManufacturerDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |manufacturerData|, | ||
<a>converted to an ECMAScript value</a>. If this throws an exception, | ||
propagate that exception and abort these steps. | ||
1. Call <a abstract-op>CreateDataProperty</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
|canonicalizedDataFilter|). | ||
(|canonicalizedFilter|.manufacturerData, | ||
<code>|manufacturerData|.{{BluetoothManufacturerDataFilterInit/companyIdentifier}}</code>, | ||
|canonicalizedManufacturerDataFilter|). | ||
1. Set <code>|canonicalizedFilter|.serviceData</code> to `{}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
1. Let |canonicalizedDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |dataFilter|, | ||
1. Let |canonicalizedServiceDataFilter| be the result of <a | ||
for="BluetoothDataFilterInit">canonicalizing</a> |serviceData|, | ||
<a>converted to an ECMAScript value</a>. If this throws an exception, | ||
propagate that exception and abort these steps. | ||
1. Call <a | ||
abstract-op>CreateDataProperty</a>(|canonicalizedFilter|.serviceData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.bs
Outdated
@@ -1400,51 +1431,42 @@ returned from the following steps: | |||
<code><var>filter</var>.namePrefix</code>. | |||
1. Set <code>|canonicalizedFilter|.manufacturerData</code> to `{}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
953f24d
to
e7a6e1a
Compare
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
SHA: d9eeae5 Reason: push, by @beaufortfrancois Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: d9eeae5 Reason: push, by @beaufortfrancois Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: d9eeae5 Reason: push, by @beaufortfrancois Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: d9eeae5 Reason: push, by @beaufortfrancois Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830933 Commit-Queue: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#879284}
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830933 Commit-Queue: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#879284}
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830933 Commit-Queue: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#879284}
…ilter when requesting device, a=testonly Automatic update from web-platform-tests [Web Bluetooth] Add `manufacturerData` filter when requesting device This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830933 Commit-Queue: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#879284} -- wpt-commits: d50983bfca33b58be57894725b190b8c1a011ddc wpt-pr: 28718
This CL adds support for new manufacturerData filter so that developers can request Bluetooth LE devices based on manufacturer specific data (company identifier and data). Spec: WebBluetoothCG/web-bluetooth#545 Test: https://manufacturer-data.glitch.me/ Bug: 707635 Change-Id: I63b80812f35c8f0f557ceaf53632d0d6d2d52b9b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830933 Commit-Queue: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#879284} NOKEYCHECK=True GitOrigin-RevId: 33578ed2957f2568a1bb9da1222ff964887a7ed0
The more I'm playing with manufacturer data filters, the more I think we should go with a
sequence
instead of amap
in BluetoothLEScanFilterInit for bothmanufacturerData
andserviceData
.Because users can have different strings to express the same uint16 ('0' and '00' for instance), we'll have to check for the unicity of the key which is what we're doing already with a sequence.
Moreover, having a required
companyIdentifier
dictionary key seems more readable than a simple object key.I've added some code samples below to give you an idea of what I'm experiencing.
And here's what I'm proposing:
@reillyeon What do you think?
Preview | Diff