Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync volume check #2833

Closed
irvinm opened this issue Mar 9, 2021 · 2 comments
Closed

Sync volume check #2833

irvinm opened this issue Mar 9, 2021 · 2 comments
Labels

Comments

@irvinm
Copy link
Contributor

irvinm commented Mar 9, 2021

Short description

Related to previous discussions around the amount of allowable sync data (#2623 and #2678) and reviewing your code comment:

// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync
// Use 6 * 1024 instead of 8 * 1024 (max of the quota) for safety.
// For example, 6 * 8 = 48KB is the max size of the user style rules.
export const kSYNC_STORAGE_SAFE_QUOTA = 6 * 1024;

It appears the allowable amount to be synced should be at least 48k.

With my TST CSS currently at around 30k characters (including spaces) and the total sum of my chunkedUserStyleRules(0-5) at 36,635 characters, when I add one or two more lines to my TST CSS it triggers the editor's size check warning that the CSS is too long and needs to be reduced.

I can remove comments to get back under the quota, but just wanted to see if this is the behavior you would expect given the raw numbers.

Steps to reproduce

  1. Start Firefox with clean profile.
  2. Install TST.
  3. Sync\Load 30k character CSS. (TST settings export: [email protected])
  4. Copy and paste a block of CSS to increase the size.
  5. See warnings regarding CSS total size.

Expected result

Given the total sync storage via Firefox and even with the "safety" reduced size of CSS sync storage I would have thought more than ~30k characters of CSS should be able to be synced.

Actual result

CSS editor size warning to reduce CSS size will be triggered. (I have not verified if the sync is blocked when this occurs and\or if the chunking stops until the editor size is reduced.) I never see chunkedUserStyleRules6 and chunkedUserStyleRules7 being used at all.

image

Environment

  • Platform (OS): Windows 10 x64 (20H2)
  • Version of Firefox: 86.0
  • Version (or revision) of Tree Style Tab: 3.7.3
@irvinm
Copy link
Contributor Author

irvinm commented Mar 24, 2021

@piroor any initial thoughts on this?

@piroor
Copy link
Owner

piroor commented Mar 30, 2021

Thanks, there was a mistake and TST didn't use full of allowed slots to save chunked data. With the commit 9f2486a now TST uses all 8 slots for both user styles and sent tabs.

  • The old (wrong) maximum size of those chunked data: 6 * 1024 * 6 * 2 = 73728(bytes)
  • The new (correct) maximum size of those chunked data: 6 * 1024 * 8 * 2 = 98304(bytes)
  • The maximum size of all sync storage of an addon: 102400(bytes)
  • The rest allowed data size for other options: 102400 - 98304 = 4096(bytes)

@piroor piroor added the fixed label Mar 30, 2021
@irvinm irvinm closed this as completed Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants