NEW 199084
Feature: Implement Device Memory API
https://bugs.webkit.org/show_bug.cgi?id=199084
Summary Feature: Implement Device Memory API
Thomas Steiner
Reported 2019-06-20 15:48:19 PDT
The Device Memory API allows an application to reason about the available RAM it can use. - Spec: https://www.w3.org/TR/device-memory/ - Remarks on limiting the fingerprint surface through coarse reporting: https://w3c.github.io/device-memory/#computing-device-memory-value This API is used by Google Search as one of the signals to determine whether a service worker is being offered: https://web.dev/google-search-sw/#service-worker-overhead.
Attachments
Radar WebKit Bug Importer
Comment 1 2019-06-20 17:29:52 PDT
Maciej Stachowiak
Comment 2 2019-06-20 17:40:37 PDT
Thanks for the bug report! Does Google search need the Client Hint form of this, or is the API sufficient? The post seems to mention that the only use is to make a rough cut of "low end device" vs "high end device" based on >= 2 GB. It's a shame that the API exposes much more than that. Maybe we could expose 2GB as a fixed value for macOS, iOS and iPadOS devices, since all currently supported models would likely meet the true "high end" criteria.
Thomas Steiner
Comment 3 2019-06-21 02:28:22 PDT
(In reply to Maciej Stachowiak from comment #2) > Thanks for the bug report! Does Google search need the Client Hint form of > this, or is the API sufficient? The post seems to mention that the only use > is to make a rough cut of "low end device" vs "high end device" based on >= > 2 GB. It's a shame that the API exposes much more than that. Maybe we could > expose 2GB as a fixed value for macOS, iOS and iPadOS devices, since all > currently supported models would likely meet the true "high end" criteria. The JavaScript API. The current (minified) code uses this: ``` function u(a) { var b = window.navigator; if (!b) return !1; b = b.deviceMemory; return a.dm && (b < Number(a.dmn) || 0 != Number(a.dmx) && b >= a.dmx) ? !1 : !0 } ``` Capping at (or fixed reporting of) 2GB seems fine (for all iOS/iPadOS devices); actually, Chrome caps at 8GB (https://crbug.com/787473). Both Chrome's as well as potentially your threshold probably need to be re-evaluated once 2GB of RAM means one owns a "low end" device.
Note You need to log in before you can comment on or make changes to this bug.