-
-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Is your feature request related to a problem? Please describe.
Currently there are 3 settings values that are stored, blocking_enabled (renamed in #42 from prior key state (EDIT: rename potentially going to be reverted)), notificationsAllowed, and allowed_domain_list. These values are stored in the extension's storage.local StorageArea, along with blocked_hosts, blocked_ports, and badgeswhich all hold logging data of blocked hosts/ports/counts on a per-tab basis.
Additionally, settings aren't set to their default values in one central place, instead default values are passed at each storage-reading function call, leading to potentially confused state if different defaults are used in different checks.
Describe the solution you'd like
- Have a settings migration and defaults initialization method that is called on extension install or optionally by a "reset settings" button on the options page. Will also need to also account for not overriding users' existing whitelists/configs as this feature gets rolled out and on subsequent extension updates.
- Implement versioning for stored settings data to make schema upgrades easier. Probably way over-engineering it but could also be useful. Likely won't work on this unless it's deemed necessary
- Drop
unlimitedStoragefrom the extension's permissions. If the extension is somehow using more storage than the cap allows, it's probably a memory/storage leak somewhere (which would be harder to catch sinceunlimitedStoragewould disable any storage overuse errors by raising the cap unreachably high) - Reorganize all per-tab data (
badges,blocked_hosts,blocked_ports, and anything new added)- Move to the
storage.sessionStorageArea to be cleared on browser-close. Pretty sure this isn't necessary from a memory-leak perspective (background.js:handleUpdated()I think cleans up well enough on tab navigation), but it's a lot of data sitting around in permanent storage that doesn't need to be. - Flip access pattern from
<data_type>[tab_id]totab_data[tab_id].<data_type>or[tab_id].<data_type>(stored "naked" under keytab_id. Would enable safer parallel read/writes (afterBrowserStorageManagerchanges to enable) but could more easily lose data).
- Move to the
- Stop
JSON.stringify()ing all data before storing. MDN says it's safe to store basic objects, arrays, etc. directly. (EDIT: postponed, might have issues in our code around shallow/deep object copying or stale references, want to investigate further)
Additional context
Mainly just tossing some ideas I planned to work on into the public forum to get feedback on. When I get to it I'll have a new branch on my fork if people want to poke and prod at the code.
EDIT: Moved settings sync to own issue: #49