-
Notifications
You must be signed in to change notification settings - Fork 28
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
editorial: Formally define a permission revocation algorithm. #297
editorial: Formally define a permission revocation algorithm. #297
Conversation
While this change is not big, it modifies a concept we have in the spec, so I'd appreciate some extra pairs of eyes to double-check it all makes sense. |
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.
Good catch
Thanks, I'll wait a bit more for either @reillyeon or @marcoscaceres before merging. |
The "block a permission" algorithm was manipulating a `PermissionDescriptor` instance to change its "permission state" and then release any existing locks. However, the Permissions spec does not actually define a way for other specifications to modify a PermissionDescriptor's permission state. What we want here is to react to a user-triggered change that sets the permission state to "denied". That's what the "permission revocation algorithm" hook in the Permissions spec does, so instead of defining a "block a permission" algorithm define a custom "permission revocation algorithm" instead. Related to w3c#198 -- one of @marcoscaceres' comments is about hooking more of the permissions text directly into the Permissions spec.
11dcd60
to
50b0b03
Compare
This may have made more sense back when we had a custom `WakeLockPermissionDescriptor`, but even then this felt like implementing a custom permission model for no reason. We are just interested in knowing whether we have permission to request a wake lock from the platform, and we can use the Permission spec's "request permission to use" algorithm for that just fine. One important change is related to checking transient activation: the "obtain a permission" algorithm essentially denied requests when "screen-wake-lock"'s permission state was set to "prompt" AND there was no transient user activation. In general, an API should either always or never be user-activation gated. Given Blink is the only current implementation of this spec and it does not currently gate this API on user activation, the transient user activation check was removed altogether for now. Together with w3c#297, this fixes w3c#187 and fixes w3c#198.
FTR: I've filed a Blink bug to track this spec change in https://bugs.chromium.org/p/chromium/issues/detail?id=1174963 |
Especially after w3c#297 ("editorial: Formally define a permission revocation algorithm"), it makes more sense to reference this test from the definition of the "screen-wake-lock" powerful feature, as the test has nothing to do with the permission revocation algorithm.
Especially after #297 ("editorial: Formally define a permission revocation algorithm"), it makes more sense to reference this test from the definition of the "screen-wake-lock" powerful feature, as the test has nothing to do with the permission revocation algorithm.
This may have made more sense back when we had a custom `WakeLockPermissionDescriptor`, but even then this felt like implementing a custom permission model for no reason. We are just interested in knowing whether we have permission to request a wake lock from the platform, and we can use the Permission spec's "request permission to use" algorithm for that just fine. One important change is related to checking transient activation: the "obtain a permission" algorithm essentially denied requests when "screen-wake-lock"'s permission state was set to "prompt" AND there was no transient user activation. In general, an API should either always or never be user-activation gated. Given Blink is the only current implementation of this spec and it does not currently gate this API on user activation, the transient user activation check was removed altogether for now. Together with w3c#297, this fixes w3c#187 and fixes w3c#198.
This may have made more sense back when we had a custom `WakeLockPermissionDescriptor`, but even then this felt like implementing a custom permission model for no reason. We are just interested in knowing whether we have permission to request a wake lock from the platform, and we can use the Permission spec's "request permission to use" algorithm for that just fine. One important change is related to checking transient activation: the "obtain a permission" algorithm essentially denied requests when "screen-wake-lock"'s permission state was set to "prompt" AND there was no transient user activation. In general, an API should either always or never be user-activation gated. Given Blink is the only current implementation of this spec and it does not currently gate this API on user activation, the transient user activation check was removed altogether for now. Together with w3c#297, this fixes w3c#187 and fixes w3c#198.
This may have made more sense back when we had a custom `WakeLockPermissionDescriptor`, but even then this felt like implementing a custom permission model for no reason. We are just interested in knowing whether we have permission to request a wake lock from the platform, and we can use the Permission spec's "request permission to use" algorithm for that just fine. One important change is related to checking transient activation: the "obtain a permission" algorithm essentially denied requests when "screen-wake-lock"'s permission state was set to "prompt" AND there was no transient user activation. In general, an API should either always or never be user-activation gated. Given Blink is the only current implementation of this spec and it does not currently gate this API on user activation, the transient user activation check was removed altogether for now. Together with #297, this fixes #187 and fixes #198.
The "block a permission" algorithm was manipulating a
PermissionDescriptor
instance to change its "permission state" and then release any existing
locks. However, the Permissions spec does not actually define a way for
other specifications to modify a PermissionDescriptor's permission state.
What we want here is to react to a user-triggered change that sets the
permission state to "denied". That's what the "permission revocation
algorithm" hook in the Permissions spec does, so instead of defining a
"block a permission" algorithm define a custom "permission revocation
algorithm" instead.
Related to #198 -- one of @marcoscaceres' comments is about hooking more of
the permissions text directly into the Permissions spec.
Preview | Diff