-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1919972 [wpt PR 48244] - WebHID: Add support for dedicated worker…
…s, a=testonly Automatic update from web-platform-tests WebHID: Add support for dedicated workers This CL exposes the WebHID API to dedicated workers behind the blink runtime feature WebHIDOnDedicatedWorkers. Intent to prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/y__BOYfZWzI Spec PR: WICG/webhid#121 Spec issue: WICG/webhid#120 Demo: https://webhid-worker.glitch.me/ Change-Id: If145f34faf9211a54c8b4a15fbe7e903411b8d1d Bug: 365932453 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5841991 Reviewed-by: Arthur Sonzogni <arthursonzognichromium.org> Reviewed-by: Yoav Weiss (Shopify) <yoavweisschromium.org> Reviewed-by: Matt Reynolds <mattreynoldschromium.org> Commit-Queue: Fr <beaufort.francoisgmail.com> Cr-Commit-Position: refs/heads/main{#1357046} -- wpt-commits: f3a05bb7fe21b6e6d8fbf5923d53abfc7c04fd66 wpt-pr: 48244 UltraBlame original commit: 091c9c912077b35fe3eb0526c59790da67a80a9a
- Loading branch information
Showing
11 changed files
with
1,669 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
testing/web-platform/tests/permissions-policy/resources/permissions-policy-hid-worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
< | ||
script | ||
> | ||
' | ||
use | ||
strict | ||
' | ||
; | ||
let | ||
worker | ||
= | ||
new | ||
Worker | ||
( | ||
' | ||
permissions | ||
- | ||
policy | ||
- | ||
hid | ||
- | ||
worker | ||
. | ||
js | ||
' | ||
) | ||
; | ||
worker | ||
. | ||
onmessage | ||
= | ||
event | ||
= | ||
> | ||
{ | ||
window | ||
. | ||
parent | ||
. | ||
postMessage | ||
( | ||
event | ||
. | ||
data | ||
' | ||
* | ||
' | ||
) | ||
; | ||
} | ||
; | ||
worker | ||
. | ||
postMessage | ||
( | ||
{ | ||
type | ||
: | ||
' | ||
ready | ||
' | ||
} | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |
96 changes: 96 additions & 0 deletions
96
testing/web-platform/tests/permissions-policy/resources/permissions-policy-hid-worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
' | ||
use | ||
strict | ||
' | ||
; | ||
/ | ||
/ | ||
Dedicated | ||
worker | ||
if | ||
( | ||
typeof | ||
postMessage | ||
= | ||
= | ||
= | ||
' | ||
function | ||
' | ||
) | ||
{ | ||
onmessage | ||
= | ||
event | ||
= | ||
> | ||
{ | ||
switch | ||
( | ||
event | ||
. | ||
data | ||
. | ||
type | ||
) | ||
{ | ||
case | ||
' | ||
ready | ||
' | ||
: | ||
navigator | ||
. | ||
hid | ||
. | ||
getDevices | ||
( | ||
) | ||
. | ||
then | ||
( | ||
( | ||
) | ||
= | ||
> | ||
postMessage | ||
( | ||
{ | ||
type | ||
: | ||
' | ||
availability | ||
- | ||
result | ||
' | ||
enabled | ||
: | ||
true | ||
} | ||
) | ||
error | ||
= | ||
> | ||
postMessage | ||
( | ||
{ | ||
type | ||
: | ||
' | ||
availability | ||
- | ||
result | ||
' | ||
enabled | ||
: | ||
false | ||
} | ||
) | ||
) | ||
; | ||
break | ||
; | ||
} | ||
} | ||
; | ||
} |
93 changes: 93 additions & 0 deletions
93
testing/web-platform/tests/permissions-policy/resources/permissions-policy-hid.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
< | ||
script | ||
> | ||
' | ||
use | ||
strict | ||
' | ||
; | ||
Promise | ||
. | ||
resolve | ||
( | ||
) | ||
. | ||
then | ||
( | ||
( | ||
) | ||
= | ||
> | ||
navigator | ||
. | ||
hid | ||
. | ||
getDevices | ||
( | ||
) | ||
) | ||
. | ||
then | ||
( | ||
devices | ||
= | ||
> | ||
{ | ||
window | ||
. | ||
parent | ||
. | ||
postMessage | ||
( | ||
{ | ||
type | ||
: | ||
' | ||
availability | ||
- | ||
result | ||
' | ||
enabled | ||
: | ||
true | ||
} | ||
' | ||
* | ||
' | ||
) | ||
; | ||
} | ||
error | ||
= | ||
> | ||
{ | ||
window | ||
. | ||
parent | ||
. | ||
postMessage | ||
( | ||
{ | ||
type | ||
: | ||
' | ||
availability | ||
- | ||
result | ||
' | ||
enabled | ||
: | ||
false | ||
} | ||
' | ||
* | ||
' | ||
) | ||
; | ||
} | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |
Oops, something went wrong.