diff --git a/storage.bs b/storage.bs index 79497f6..7ed13bf 100644 --- a/storage.bs +++ b/storage.bs @@ -18,7 +18,7 @@ these APIs by defining:
Traditionally, as the user runs out of storage space on their device, the data stored with these @@ -178,7 +178,27 @@ larger site storage quota. Factors such as navigation frequency, recency bookmarking, and permission for {{"persistent-storage"}} can be used as indications of "popularity". +The application cache site storage usage for an origin +origin is a rough estimate of the amount of bytes used in Application Cache +in origin's site storage unit. Application Cache can contain cross-origin +opaque responses, thus it is important to obfuscate the size for security reasons. The +solution for this is to artificially pad the size of cross-origin responses (see [[#padding]]). +[[!HTML]] +The caches site storage usage for an origin +origin is a rough estimate of the amount of bytes used in {{CacheStorage}} API +in origin's site storage unit. Caches can contain cross-origin +opaque responses, thus it is important to obfuscate the size for security reasons. The +solution for this is to artificially pad the size of cross-origin responses (see [[#padding]]). +[[!SERVICE-WORKERS]] + +The indexedDB site storage usage for an origin +origin is a rough estimate of the amount of bytes used in IndexedDB +in origin's site storage unit. [[!IndexedDB]] + +The service worker registration site storage usage for an +origin origin is a rough estimate of the amount of bytes +used in service worker registrations in origin's site storage unit. [[!SERVICE-WORKERS]]
persisted()
method, when invoked, must run
@@ -331,11 +360,40 @@ must run these steps:
Let quota be site storage quota for origin. -
Let dictionary be a new {{StorageEstimate}} dictionary whose {{usage}} member - is usage and {{quota}} member is quota. +
Let applicationCache be application cache site storage usage + for origin. + +
Let indexedDB be indexedDB site storage usage for origin. + +
Let caches be caches site storage usage for origin. + +
Let serviceWorkerRegistrations be service worker registration + site storage usage for origin. + +
Let usageDetails be a new {{StorageUsageDetails}} dictionary. + +
If applicationCache is greater than 0, set the + {{StorageUsageDetails/applicationCache}} member of usageDetails to + applicationCache. + +
If indexedDB is greater than 0, set the + {{StorageUsageDetails/indexedDB}} member of usageDetails to + indexedDB. + +
If caches is greater than 0, set the + {{StorageUsageDetails/caches}} member of usageDetails to + caches. + +
If serviceWorkerRegistrations is greater than 0, set the + {{StorageUsageDetails/serviceWorkerRegistrations}} member of usageDetails to + serviceWorkerRegistrations. + +
Let dictionary be a new {{StorageEstimate}} dictionary whose {{StorageEstimate/usage}} member + is usage, {{StorageEstimate/quota}} member is quota and {{StorageEstimate/usageDetails}} + member is usageDetails.
If there was an internal error while obtaining usage and quota, then +
If there was an internal error while obtaining any of the above, then queue a task to reject promise with a {{TypeError}}.
Internal errors are supposed to be extremely rare and indicate some kind of @@ -348,7 +406,21 @@ must run these steps:
Return promise. +
Let response be a new {{Response}} from an opaque origin to + be stored in Application Cache or {{CacheStorage}}. +
Let size be the size, in bytes, of response. +
Let padding size be a randomly generated padding size, in bytes. + size. +
Store padding size along with the size as metadata alongside + response in Application Cache or {{CacheStorage}}. +
When queried about size, return the sum of size and padding size +