Skip to content

Commit ecceb0a

Browse files
author
Jarryd Goodman
committed
Add UsageDetails dictionary.
squash 47187f6 Address style nits from domenic. squash 0fd3b44 Explicitly define each storage system's usage.
1 parent 725373f commit ecceb0a

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

storage.bs

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ these APIs by defining:
1818
<ul class=brief>
1919
<li>A bucket, the primitive these APIs store their data in
2020
<li>A way of making that bucket persistent
21-
<li>A way of getting usage and quota estimates for an <a for=/>origin</a>
21+
<li>A way of getting usage, quota, and per-system usage estimates for an <a for=/>origin</a>
2222
</ul>
2323

2424
<p>Traditionally, as the user runs out of storage space on their device, the data stored with these
@@ -178,7 +178,21 @@ larger <a>site storage quota</a>. Factors such as navigation frequency, recency
178178
bookmarking, and <a href="#persistence">permission</a> for {{"persistent-storage"}} can be used as
179179
indications of "popularity".
180180

181+
The <dfn export>application cache site storage usage</dfn> for an <a for=/>origin</a>
182+
<var>origin</var> is a rough estimate of the amount of bytes used in Application
183+
Cache in <var>origin</var>'s <a>site storage unit</a>. [[HTML#appcache]]
181184

185+
The <dfn export>caches site storage usage</dfn> for an <a for=/>origin</a>
186+
<var>origin</var> is a rough estimate of the amount of bytes used in Cache API
187+
in <var>origin</var>'s <a>site storage unit</a>. [[SERVICE-WORKERS#cache-objects]]
188+
189+
The <dfn export>indexedDB site storage usage</dfn> for an <a for=/>origin</a>
190+
<var>origin</var> is a rough estimate of the amount of bytes used in IndexedDB
191+
in <var>origin</var>'s <a>site storage unit</a>. [[!IndexedDB]]
192+
193+
The <dfn export>service worker registration site storage usage</dfn> for an
194+
<a for=/>origin</a> <var>origin</var> is a rough estimate of the amount of bytes
195+
used in service worker registrations in <var>origin</var>'s <a>site storage unit</a>. [[!SERVICE-WORKERS]]
182196

183197
<h2 id=ui-guidelines>User Interface Guidelines</h2>
184198

@@ -234,7 +248,16 @@ interface StorageManager {
234248
dictionary StorageEstimate {
235249
unsigned long long usage;
236250
unsigned long long quota;
251+
StorageUsageDetails usageDetails;
252+
};
253+
254+
dictionary StorageUsageDetails {
255+
unsigned long long applicationCache;
256+
unsigned long long caches;
257+
unsigned long long indexedDB;
258+
unsigned long long serviceWorkerRegistrations;
237259
};
260+
238261
</pre>
239262

240263
The <dfn method for=StorageManager><code>persisted()</code></dfn> method, when invoked, must run
@@ -331,11 +354,40 @@ must run these steps:
331354

332355
<li><p>Let <var>quota</var> be <a>site storage quota</a> for <var>origin</var>.
333356

334-
<li><p>Let <var>dictionary</var> be a new {{StorageEstimate}} dictionary whose {{usage}} member
335-
is <var>usage</var> and {{quota}} member is <var>quota</var>.
357+
<li><p>Let <var>applicationCache</var> be <a>application cache site storage usage</a>
358+
for <var>origin</var>.
359+
360+
<li><p>Let <var>indexedDB</var> be <a>indexedDB site storage usage</a> for <var>origin</var>.
361+
362+
<li><p>Let <var>caches</var> be <a>caches site storage usage</a> for <var>origin</var>.
363+
364+
<li><p>Let <var>serviceWorkerRegistrations</var> be <a>service worker registration
365+
site storage usage</a> for <var>origin</var>.
366+
367+
<li><p>Let <var>usageDetails</var> be a new {{StorageUsageDetails}} dictionary.
368+
369+
<li><p>If <var>applicationCache</var> is greater than 0, set the
370+
{{StorageUsageDetails/applicationCache}} member of <var>usageDetails</var> to
371+
<var>applicationCache</var>.
372+
373+
<li><p>If <var>indexedDB</var> is greater than 0, set the
374+
{{StorageUsageDetails/indexedDB}} member of <var>usageDetails</var> to
375+
<var>indexedDB</var>.
376+
377+
<li><p>If <var>caches</var> is greater than 0, set the
378+
{{StorageUsageDetails/caches}} member of <var>usageDetails</var> to
379+
<var>caches</var>.
380+
381+
<li><p>If <var>serviceWorkerRegistrations</var> is greater than 0, set the
382+
{{StorageUsageDetails/serviceWorkerRegistrations}} member of <var>usageDetails</var> to
383+
<var>serviceWorkerRegistrations</var>.
384+
385+
<li><p>Let <var>dictionary</var> be a new {{StorageEstimate}} dictionary whose {{StorageEstimate/usage}} member
386+
is <var>usage</var>, {{StorageEstimate/quota}} member is <var>quota</var> and {{StorageEstimate/usageDetails}}
387+
member is <var>usageDetails</var>.
336388

337389
<li>
338-
<p>If there was an internal error while obtaining <var>usage</var> and <var>quota</var>, then
390+
<p>If there was an internal error while obtaining any of the above, then
339391
<a>queue a task</a> to reject <var>promise</var> with a {{TypeError}}.
340392

341393
<p class=note>Internal errors are supposed to be extremely rare and indicate some kind of

0 commit comments

Comments
 (0)