我有一个 Chrome 扩展程序,我正在使用离线存储来存储一些数据。我已经unlimitedStorage
在清单文件中设置了权限,所以我可以访问机器允许的尽可能多的存储空间。
请求手册页中提到的配额是否有意义?
另一个问题是:我尝试要求比机器上可用的存储空间更多的存储空间,并且没有错误地授予它(例如,我有一个 500GB 的磁盘,我要求的是 10TB)。这是一个错误还是预期的行为?
这是我使用的代码:
navigator.webkitPersistentStorage.requestQuota(10*1024*1024*1024*1024, function(grantedBytes) {console.log(grantedBytes)})
> 10995116277760
显然,如果我检查授予的配额,我会得到正确的数量:
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
我只是对requestQuota
请求超过实际可用存储空间时不返回错误感到困惑。