Skip to content
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

LibWeb: Implement navigator.deviceMemory #1681

Conversation

gmta
Copy link
Collaborator

@gmta gmta commented Oct 8, 2024

Fixes at least 2 subtests in wpt/device-memory.

@gmta gmta force-pushed the libweb-implement-navigator-deviceMemory branch 3 times, most recently from f0560e3 to da497b2 Compare October 8, 2024 14:01
@awesomekling
Copy link
Member

Mild fingerprinting concern, but it's not like we have a structured way of dealing with that at this point in time.

@gmta
Copy link
Collaborator Author

gmta commented Oct 8, 2024

Mild fingerprinting concern, but it's not like we have a structured way of dealing with that at this point in time.

The spec already tries to prevent fingerprinting somewhat by rounding to a power of 2 (which, of course, does not help a lot) and clamping the resulting value. We could tighten up the lower and upper bounds of the values we return; that's allowed by the spec.

@gmta gmta force-pushed the libweb-implement-navigator-deviceMemory branch from da497b2 to cfa93b3 Compare October 8, 2024 14:50
@gmta
Copy link
Collaborator Author

gmta commented Oct 8, 2024

I went ahead and tightened the clamps on the returned values. It now only returns 1, 2 or 4 GiB of physical memory. I expect this to be enough for code to determine whether they're dealing with a very low memory device or one with "enough" memory, while improving fingerprinting prevention a bit.

@awesomekling awesomekling merged commit 69f11fc into LadybirdBrowser:master Oct 8, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants