-
Notifications
You must be signed in to change notification settings - Fork 303
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 synchronous GPUAdapter.info #4550
Conversation
- Add a `[SameObject] readonly attribute GPUAdapterInfo info;` to `GPUAdapter`. - It returns the same JS object every time you access it. - `requestAdapterInfo` still returns a new one each time for minor backward-compatibility reasons. - **HOWEVER** it has been changed to always return an already-resolved promise instead of resolving later. - If the info available to the page changes for some reason (generally shouldn't), the attributes on the `GPUAdapterInfo` object start returning different values (like an empty string gets changed to a non-empty string). Fixes 4536
Previews, as seen when this build job started (5fee248): |
We definitely want to bring this up with the rest of the group, but if we do allow synchronous adapter info then I agree this is the way to expose it. That said, if we change it to be synchronous I'd prefer to see |
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.
@jimblandy What's your take on this PR?
Is there a scenario where this may happen that wouldn't also end up surfacing a new |
We could do that. I was thinking of a case where for whatever reason we decide to expose more information about the adapter after you've already looked at it once. But that's probably never going to happen and if it did we could totally just expire the adapter. Good catch, I think it makes more sense. |
Finally updated. |
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.
LGTM (% group approval) with one nit.
Mozilla doesn't have plans to prompt the user when content calls |
At the meeting we particularly need to discuss whether we're deprecating requestAdapterInfo with the intent to try to remove it (firefox/safari could even ship without it), or just leaving it for compatibility. |
Closing in favor of a new PR to avoid being too confusing by editing this one. |
GPU Web WG 2024-05-22 Atlantic-time
|
Adds a
[SameObject] readonly attribute GPUAdapterInfo info;
toGPUAdapter
.Important points:
GPUAdapter
may no longer change. You can only get new info by getting a newGPUAdapter
. (The only reason this should happen is if someone adds a permission prompt for fingerprintability.)requestAdapterInfo()
is explicitly "deprecated (but not planned for removal)" (non-normative note)requestAdapterInfo()
should never in the future change to add a user permission prompt (even with a new argument)adapter.info
before callingadapter.requestAdapterInfo({ pleasePrompt: true })
would cause the latter to not produce any new info). Instead, any permission elevation would need to occur before the call torequestAdapter()
, for example through some new call that grants a new Permissions API permission.Less important points:
adapter.info
returns the same JS object every time you access it.requestAdapterInfo
still returns a new one each time for minor backward-compatibility reasons, but now always returns an already-resolved promise (a non-normative note promises this).Fixes #4536