fix sync storage for Firefox webext (#622)

This commit is contained in:
gorhill 2017-03-05 12:12:58 -05:00
parent 4d1ed37556
commit d7c1f2f919
1 changed files with 5 additions and 2 deletions

View File

@ -1312,10 +1312,13 @@ vAPI.cloud = (function() {
var maxChunkCountPerItem = Math.floor(512 * 0.75) & ~(chunkCountPerFetch - 1); var maxChunkCountPerItem = Math.floor(512 * 0.75) & ~(chunkCountPerFetch - 1);
// Mind chrome.storage.sync.QUOTA_BYTES_PER_ITEM (8192 at time of writing) // Mind chrome.storage.sync.QUOTA_BYTES_PER_ITEM (8192 at time of writing)
var maxChunkSize = Math.floor(chrome.storage.sync.QUOTA_BYTES_PER_ITEM * 0.75); var maxChunkSize = Math.floor(chrome.storage.sync.QUOTA_BYTES_PER_ITEM * 0.75 || 6144);
// Mind chrome.storage.sync.QUOTA_BYTES (128 kB at time of writing) // Mind chrome.storage.sync.QUOTA_BYTES (128 kB at time of writing)
var maxStorageSize = chrome.storage.sync.QUOTA_BYTES; // Firefox:
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/sync
// > You can store up to 100KB of data using this API/
var maxStorageSize = chrome.storage.sync.QUOTA_BYTES || 102400;
var options = { var options = {
defaultDeviceName: window.navigator.platform, defaultDeviceName: window.navigator.platform,