-
Notifications
You must be signed in to change notification settings - Fork 29
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
Consume user activation #218
base: gh-pages
Are you sure you want to change the base?
Conversation
@martinthomson, @saschanaz, we are contemplating doing this in WebKit, so are seeking input from a (potential) second implementation. I'm wondering if you'd be interested in making this change also in Gecko? It's a potentially breaking change, but I think it's worth it to mitigate some of the above. As an aside, I've also specified Gecko's mitigations for resisting fingerprinting #215 |
I don't have any objection, but I'd like to see the pioneer's experience before implementing it in Gecko 🙂 cc @smaug---- |
I am having trouble to understand why one would need transient activation for this. At least I wouldn't implement this before there is some telemetry data about the current usage. |
Hmm yeah, have we actually observed any abuse or is this just to prevent potential abuse? I do see the point to prevent fingerprinting, but it would be very visible for users, no? |
@smaug---- wrote:
For example I actually accidentally triggered this behavior with a test and it's extremely annoying to break out of on a mobile device: // Orientation loop!
screen.orientation.onchange = async () => {
// the event will fire again ... and again...
await screen.orientation.lock(getOppositeOrientation());
}
await screen.orientation.lock(getOppositeOrientation());
No necessarily. If you make the background black, or if the UA doesn't animate (e.g., reduce animation) when switching orientation, the user might not notice anything. |
In case you want to see how annoying it is (try it on Android): |
right, and then I wouldn't use that site again. Sites can do many annoying things. |
This somehow throws NotSupportedError on Firefox for Android 🤔 |
@smaug---- wrote:
That seems really unfair on users and an extremely privileged position to take: users don't always have a choice as to which sites they use. Sometimes there is no alternative (e.g., government websites, specific mail provider, work related, etc.). We have the opportunity for sites to do the right thing here.
Sure, but that's not a reason to keep the status quo or to make things worse. By that logic, we should have never added We should be aiming to make things better when we spot issues (even if it breaks a few sites).
No, but given the API is gated already on fullscreen, which requires transient activation, it should be broadly compatible. I don't think I'd ship this in webkit without this mitigation, for the reasons I already gave. I'm inviting other browser vendors to make what are pretty reasonable changes (along with #230). |
@saschanaz wrote:
I spotted that too. That's it's already not interoperable across browsers may be our saving grace 😇. |
Oh! so no joke... It looks like locking might be disabled by default on Firefox for Android 🤯. See: And see below for where the NotAllowedError is coming from a few lines below: @saschanaz, can you check if |
Ok, enabling it also starts rejecting with I think it's rejecting the in Gecko because calling .lock() again inside the event handler is causing the AbortError to be returned (as the first promise hasn't settled). |
Oh, https://bugzilla.mozilla.org/show_bug.cgi?id=1767449 tracks that, thanks. Didn't know that! Given that Fullscreen API does not consume the activation, I think this should have a telemetry so that we can know what websites will break when screen locking consumes it.
Confirmed. Can we spec this instead? 😂 |
As an aside, I updated all the WPT tests a few days ago. I think this is the relevant test: |
@smaug----, @saschanaz, here is another case where it might make sense to consume the user activation: whatwg/html#8490 Would appreciate your input. |
just fyi, WebKit doesn't have a means to collect telemetry, but I still feel pretty strongly that the API should require and consume user activation. There is no valid use case for that I can think of for allowing a site to continually switch screen orientations without a gesture. |
Would this break entering fullscreen and locking orientation with one activation if requestFullscreen consumes the gesture per whatwg/fullscreen#153 ? |
Something not everyone will be able to do. People with physical disabilities, particularly those that affect upper body movement and mobility, may have their device attached (to their wheelchair for example) in a fixed position, and so turning their device to match the orientation is not an option. |
Thanks for your work here, @marcoscaceres. We should absolutely prevent abuse akin to your compelling example. The most apparent risk is breaking uses of Element.requestFullscreen() and Screen.Orientation.lock() from one transient user activation. Long term, whatwg/fullscreen#186 seems nice, but we should avoid breaking existing sites. My best naive idea is an internal slot to permit locking orientation without transient user activation shortly after a fullscreen request (akin to the slot discussed in whatwg/html#8490). I'm not aware of other use cases for locking orientation without consuming a transient user activation (e.g. auto-advancing media queue, games, mapping). Still, attempting to measure potential impact seems like a prerequisite to making a potentially disruptive change. Collecting new Chromium metrics beyond the basic use counter might help. |
Resolution: Let's just spec potential mitigation and not do this (and suggest rate limiting)... and maybe push whatwg/fullscreen#186 |
Closes #210
The purpose of this change is to somewhat mitigate the following abuse case, which could be used for hypothetical fingerprinting attack. It could also just generally annoy users if web applications can randomly change orientation while in fullscreen.
The following tasks have been completed:
Implementation commitment:
Preview | Diff