-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add steps for parsing the blocklist and testing blocklistedness #239
Changes from 2 commits
7f28ba6
00ee632
528592a
39c50be
0c7ace0
a256a3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2320,33 +2320,27 @@ The result of <dfn>parsing the blocklist</dfn> at a {{URL}} |url| is a [=list=] | |
of {{USBBlocklistEntry}} objects produced by the following algorithm: | ||
|
||
1. Fetch |url| and let |contents| be its body, decoded as UTF-8. | ||
1. Let |lines| be the result of invoking | ||
{{String/split(separator, limit)}} on |contents| with separator | ||
<code>'\n'</code>. | ||
1. Let |lines| be the result of [=strictly splitting=] |contents| starting | ||
from the beginning of |contents| on code point <code>'\n'</code>. | ||
1. Let |blocklist| be an empty [=list=]. | ||
1. [=list/For each=] |line| of |lines|: | ||
1. Let |commentBegin| be the result of invoking | ||
|line|.{{String/indexOf()}} with <code>'#'</code>. | ||
1. If |commentBegin| is not -1, set |line| to the result of invoking | ||
|line|.{{String/substring()}} with 0 and |commentBegin|. | ||
1. Set |line| to the result of |line|.{{String/trimEnd()}}. | ||
1. Let |components| be the result of invoking | ||
|line|.{{String/split(separator, limit)}} with separator | ||
<code>':'</code>. | ||
1. Set |line| to the result of [=collecting a sequence of code points=] | ||
not equal to <code>'#'</code> from |line| starting from the beginning | ||
of |line|. | ||
1. Set |line| to the result of [=stripping leading and trailing ASCII | ||
whitespace=] from |line|. | ||
1. Let |components| be the result of [=strictly splitting=] |line| | ||
starting from the beginning of |line| on code point <code>':'</code>. | ||
1. If the [=list/size=] of |components| is not 2 or 3, | ||
[=iteration/continue=]. | ||
1. Let |idVendor| be the result of invoking | ||
{{Number}}.{{Number/parseInt(string, radix)}} with |components|[0] | ||
and 16, or [=iteration/continue=] if a {{TypeError}} is thrown. | ||
1. Let |idProduct| be the result of invoking | ||
{{Number}}.{{Number/parseInt(string, radix)}} with |components|[1] | ||
and 16, or [=iteration/continue=] if a {{TypeError}} is thrown. | ||
1. Let |idVendor| be the result of interpreting |components|[0] as a | ||
hexadecimal number. | ||
1. Let |idProduct| be the result of interpreting |components|[1] as a | ||
hexadecimal number. | ||
1. If the [=list/size=] of |components| is: | ||
* 2: Let |bcdDevice| be <code>0xFFFF</code>. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is no longer necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is still needed, otherwise There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, then this needs to be swapped with the "if" above so that it is set to this default when components only has 2 elements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the issue. If we move the How about:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That LGTM. |
||
* 3: Let |bcdDevice| be the result of invoking | ||
{{Number}}.{{Number/parseInt(string, radix)}} with | ||
|components|[2] and 16, or [=iteration/continue=] if a | ||
{{TypeError}} is thrown. | ||
* 3: Let |bcdDevice| be the result of interpreting |components|[2] as | ||
a hexadecimal number. | ||
1. [=list/Append=] a new {{USBBlocklistEntry}} with |idVendor|, | ||
|idProduct|, and |bcdDevice| to |blocklist|. | ||
1. Return |blocklist|. | ||
|
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.