WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
230136
Implement 'gamepad' Permissions Policy
https://bugs.webkit.org/show_bug.cgi?id=230136
Summary
Implement 'gamepad' Permissions Policy
Marcos Caceres
Reported
2021-09-09 16:53:31 PDT
Gamepad defines has a "gamepad" permission, with an allow list of 'self'.
Attachments
Patch
(14.45 KB, patch)
2021-11-15 17:09 PST
,
Marcos Caceres
no flags
Details
Formatted Diff
Diff
Patch
(20.20 KB, patch)
2021-11-16 19:24 PST
,
Marcos Caceres
no flags
Details
Formatted Diff
Diff
Patch
(20.79 KB, patch)
2021-11-16 21:40 PST
,
Marcos Caceres
no flags
Details
Formatted Diff
Diff
Patch
(20.78 KB, patch)
2021-11-17 16:40 PST
,
Marcos Caceres
no flags
Details
Formatted Diff
Diff
Patch
(20.80 KB, patch)
2021-11-17 18:07 PST
,
Marcos Caceres
marcos
: review?
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-09-16 16:54:15 PDT
<
rdar://problem/83219098
>
Marcos Caceres
Comment 2
2021-11-11 16:05:49 PST
We are changing it to "all" instead, as "self" turned out not to be web compatible.
https://github.com/w3c/gamepad/pull/156
Marcos Caceres
Comment 3
2021-11-15 17:09:19 PST
Created
attachment 444320
[details]
Patch
Marcos Caceres
Comment 4
2021-11-16 19:24:58 PST
Created
attachment 444468
[details]
Patch
EWS Watchlist
Comment 5
2021-11-16 19:26:03 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see
https://trac.webkit.org/wiki/WPTExportProcess
Marcos Caceres
Comment 6
2021-11-16 21:40:36 PST
Created
attachment 444478
[details]
Patch
Darin Adler
Comment 7
2021-11-17 09:07:29 PST
Comment on
attachment 444478
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=444478&action=review
Feels like the test coverage is a bit light.
> Source/WebCore/Modules/gamepad/Navigator+Gamepad.idl:34 > + [ > + EnabledBySetting=GamepadsEnabled, > + CallWith=Document > + ] sequence<Gamepad> getGamepads();
I don’t think we have to break this out vertically just to fit one more attribute in. Unless this is copying and pasting directly from a specification or something. [EnabledBySetting=GamepadsEnabled, CallWith=Document] sequence<Gamepad> getGamepads();
> Source/WebCore/html/FeaturePolicy.cpp:53 > + return "Gampad";
Typo: "Gamepad".
> Source/WebCore/html/FeaturePolicy.cpp:215 > + if (item.startsWith("gamepad")) {
Not new, but why all the startsWith in this function? Is it valid to write "gamepadnotreallyimeantsomethingelse"?
> LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt:4 > +CONSOLE MESSAGE: Feature policy 'Gampad' check failed for iframe with origin '
https://localhost:8443
' and allow attribute 'gamepad 'none''. > +CONSOLE MESSAGE: Feature policy 'Gampad' check failed for iframe with origin '
https://127.0.0.1:8443
' and allow attribute 'gamepad 'none''. > +CONSOLE MESSAGE: Feature policy 'Gampad' check failed for iframe with origin '
https://localhost:8443
' and allow attribute 'gamepad 'self''. > +CONSOLE MESSAGE: Feature policy 'Gampad' check failed for iframe with origin '
https://127.0.0.1:8443
' and allow attribute 'gamepad
https://localhost:8443
'.
Here we have "Gampad".
Marcos Caceres
Comment 8
2021-11-17 16:29:33 PST
> Typo: "Gamepad".
Programming for 20+ years... never gets better 🤪
> Not new, but why all the startsWith in this function? Is it valid to write "gamepadnotreallyimeantsomethingelse"?
Yeah, the Permissions Policy parser there is fairly simple... it just does a split on ";", trims, and then checks the "startWith". I agree that it should probably be a little bit more robust. I think the updated Permission Policy spec has further parsing requirements, so eventually the parser might need to be rewritten.
Marcos Caceres
Comment 9
2021-11-17 16:40:13 PST
Created
attachment 444603
[details]
Patch
Marcos Caceres
Comment 10
2021-11-17 16:55:17 PST
> Feels like the test coverage is a bit light.
I'm open to suggestion to what else to test. We might want to eventually consolidate+improve all the Permission Policy tests, as they all basically test the same way as I did here (I just copy-pasted-modified an existing test in the tree).
Darin Adler
Comment 11
2021-11-17 17:35:03 PST
Comment on
attachment 444603
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=444603&action=review
> Source/WebCore/Modules/gamepad/NavigatorGamepad.h:30 > +#include "ExceptionOr.h"
It’s fine to include ExceptionOr.h and we have been doing that in other headers. But I’ve been wondering lately if we could get away with forward declarations instead in a case like this one. template<typename> class ExceptionOr; That typically works for other return values in other similar cases, but for some reason we haven’t done that for ExecptionOr.
Marcos Caceres
Comment 12
2021-11-17 18:05:36 PST
> template<typename> class ExceptionOr;
Ah, good idea! will add.
Marcos Caceres
Comment 13
2021-11-17 18:07:06 PST
Created
attachment 444622
[details]
Patch
Marcos Caceres
Comment 14
2021-11-25 21:26:29 PST
@Darin, just kindly checking if you could finish the review or if I should ping someone else? Really appreciate all the feedback thus far.
youenn fablet
Comment 15
2021-11-26 00:18:55 PST
Comment on
attachment 444622
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=444622&action=review
> Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp:84 > + if (!isFeaturePolicyAllowedByDocumentAndAllOwners(FeaturePolicy::Type::Gamepad, document, LogFeaturePolicyFailure::Yes))
I am not sure this is correct to get the document from the execution state. It seems to me getting it from the navigator is better. This could be tested with the edge case of a document having a same origin iframe, the iframe being denied gamepad permission, then calling iframe.contentWindow... Can you check this case?
> LayoutTests/imported/w3c/ChangeLog:9 > + * web-platform-tests/not-fully-active.https.html: Added.
This does not seem to be the right folder. This should probably be in web-platform-tests/gamepad folder. Looking at wpt, I can see tests that would seem useful, in particular gamepad-supported-by-feature-policy.html, which might be a bit redundant with http/tests/gamepad/gamepad-allow-attribute.https.html. Can we import wpt/gampepad test, either in this patch or as a preliminary patch? You can use Tools/Scripts/import-w3c-tests -t web-platform-tests/gamepad to do the import.
Darin Adler
Comment 16
2021-11-29 09:55:12 PST
My single comment didn’t imply that I was going to review this.
Darin Adler
Comment 17
2021-11-29 09:55:48 PST
Well, no that’s not right. I could review it. But let’s deal with Youenn’s comments first.
Marcos Caceres
Comment 18
2021-11-30 10:18:02 PST
Thanks for the additional feedback and comments. I'm traveling this week, but hope to address the feedback next week.
Marcos Caceres
Comment 19
2023-12-14 16:26:43 PST
The permission policy was switched to "*".
Marcos Caceres
Comment 20
2023-12-14 22:58:20 PST
Pull request:
https://github.com/WebKit/WebKit/pull/21851
EWS
Comment 21
2023-12-17 19:40:28 PST
Committed
272199@main
(82e7a7f64764): <
https://commits.webkit.org/272199@main
> Reviewed commits have been landed. Closing PR #21851 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug