Dieghito
Dieghito

Reputation: 675

Chrome Extension: Should request FS quota while having unlimited access from extension?

I have a Chrome extension and I am using the offline storage to store some data. I have set the unlimitedStorage permission inside the manifest file, so I can access as much storage as the machine allows.

Does it make sense to request the quota as mentioned in the manual page?

Another question is: I try to ask for more storage than it's available on the machine, and it's granted with no error (e.g. I have a 500GB disk and I ask for 10TB). Is this a bug or an expected behaviour?

Here's the code I use:

navigator.webkitPersistentStorage.requestQuota(10*1024*1024*1024*1024, function(grantedBytes) {console.log(grantedBytes)})

> 10995116277760

Obviously if I check the granted quota I get the correct amount:

navigator.webkitTemporaryStorage.queryUsageAndQuota ( 
    function(usedBytes, grantedBytes) {  
        console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
    }, 
    function(e) { console.log('Error', e);  }
);

> we are using  396897753  of  970267000281 bytes

I am only confused by the requestQuota not returning an error when requesting more than the actual available storage.

Upvotes: 0

Views: 55

Answers (0)

Related Questions