<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>199084</bug_id>
          
          <creation_ts>2019-06-20 15:48:19 -0700</creation_ts>
          <short_desc>Feature: Implement Device Memory API</short_desc>
          <delta_ts>2026-03-30 01:01:41 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 12</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Thomas Steiner">tomac</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mjs</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1546704</commentid>
    <comment_count>0</comment_count>
    <who name="Thomas Steiner">tomac</who>
    <bug_when>2019-06-20 15:48:19 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1546757</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-06-20 17:29:52 -0700</bug_when>
    <thetext>&lt;rdar://problem/51967753&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1546758</commentid>
    <comment_count>2</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2019-06-20 17:40:37 -0700</bug_when>
    <thetext>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 &quot;low end device&quot; vs &quot;high end device&quot; based on &gt;= 2 GB. It&apos;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 &quot;high end&quot; criteria.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1546846</commentid>
    <comment_count>3</comment_count>
    <who name="Thomas Steiner">tomac</who>
    <bug_when>2019-06-21 02:28:22 -0700</bug_when>
    <thetext>(In reply to Maciej Stachowiak from comment #2)
&gt; Thanks for the bug report! Does Google search need the Client Hint form of
&gt; this, or is the API sufficient? The post seems to mention that the only use
&gt; is to make a rough cut of &quot;low end device&quot; vs &quot;high end device&quot; based on &gt;=
&gt; 2 GB. It&apos;s a shame that the API exposes much more than that. Maybe we could
&gt; expose 2GB as a fixed value for macOS, iOS and iPadOS devices, since all
&gt; currently supported models would likely meet the true &quot;high end&quot; 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 &amp;&amp; (b &lt; Number(a.dmn) || 0 != Number(a.dmx) &amp;&amp; b &gt;= 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&apos;s as well as potentially your threshold probably need to be re-evaluated once 2GB of RAM means one owns a &quot;low end&quot; device.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>