Storage sync works when Firefox account is totally disabled?

I’m having some issues with a user who disabled in about:config the Firefox account

pref("identity.fxaccounts.enabled", false);

My question is: storage.sync in this case works correctly ?

I don’t see why not. It’s just a normal local storage that gets synchronized with the server once in a while. So if you disable Firefox account, it won’t synchronize but it will still work as a local storage.

Just make sure you are using it within the quotas (number of items below 512, each item at most 8KB and total size below 100KB).

With items what do you mean?
I mean, I save something like:
{aaa:{bbb:{}, ccc:{}, …}, ddd:{…}, …}

The item is only “aaa”, only “bbb”/“ccc” or thw whole, so borh “aaa”, “ddd” etc ?

I guess aaa and ddd are two different items, but I want to be sure

Yes, keys in the root object, so basically this:

Object.keys(await browser.storage.sync.get()).length

More info: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync#storage_quotas_for_sync_data
And for Chrome: https://developer.chrome.com/docs/extensions/reference/storage/#property-sync
(Chrome is more strict, especially regarding the number of operations per interval, since they sync data with the server almost instantly)

1 Like

Yes, thanks!
Doesn’t exists a special permission to have more space, right?

I know about the unlimitedstorage (but that’s for local), I don’t think something like that exists for sync although.

Nope, but you can zip your data and encode them to better encoding and fit much more data inside. But it’s not trivial, I’ve spend a lot of time experimenting with this.

For example, here is some compression libraries comparison using real life bookmarks-like data:

// LZ-UTF8   35 ms, ratio: 0.37, 81_284, original: 219_999
// zstd:    114 ms, ratio: 0.26, 57_131, original: 219_999
// LZMA    1660 ms, ratio: 0.25, 54_467, original: 219_999
// brotli   323 ms, ratio: 0.24, 51_733, original: 219_999

Then you need to serialize it into something that will take as little space as possible, ideally Base93, which can be crazy slow (even slower than the compression).

More info:

1 Like

Thank you :slight_smile:

1 Like