Site data storage usage increases upon opening site in multiple tabs, using only localStorage with the same keys
Categories
(Core :: Storage: localStorage & sessionStorage, defect)
Tracking
()
People
(Reporter: jhuang, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Steps to reproduce:
Open a site like: https://mdn.github.io/dom-examples/web-storage/index.html
Interact with UI on site, e.g. select one of the drop downs.
Right click on browser tab and select 'Duplicate' from context menu.
Duplicate site multiple times.
Actual results:
When opening 'Manage Data' under 'about:preferences#privacy' and checking storage size, the size for the site increases upon opening the site in new tabs. Also the site uses less than 1kb of localStorage only, whereas the site data shows a greater initial number of 128kb and increases up to 5.0Mb upon opening the site in multiple tabs.
Expected results:
When opening multiple tabs, site data should remain the same and reflect true size, as only localStorage is being used, with the same keys being set. Chrome browser does not show usage increasing when viewing the same site in multiple tabs. Attached is a screenshot
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Storage: localStorage & sessionStorage' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•3 years ago
|
||
Comment 4•3 years ago
|
||
The severity field is not set for this bug.
:janv, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 5•3 years ago
|
||
I believe the usage will go down after 20 seconds of inactivity, but it seems we will have to adjust some internal constants.
Just to verify my theory, can you set this preference dom.storage.snapshot_reusing to false ?
Also, you need to close and re-open the tab with preferences to see refreshed size in "Manage Data".
Comment 6•3 years ago
|
||
Changing the dom.storage.snapshot_reusing
to false
seems to work.
If snapshot_reusing
is true
, the storage usage grows for each new tab, but when it's false
, the usage stays the same.
Same results here, the storage usage stays around it's initial size and does not increase to 5mb when setting dom.storage.snapshot_reusing
to false
.
BTW, thank you :janv for your attention to this issue! Also, what determines inactivity? Does it require all instances of tabs with the site to be closed? Ideally it would be when tabs are open, but not actively selected and in the background. When dom.storage.snapshot_reusing
is true
, keeping a site open in multiple inactive tabs in the background while on a different site in a another tab, the storage does not go down for the site in the inactive tabs no matter how long.
Comment 9•3 years ago
•
|
||
I meant that if there are no setItem
, getItem
, etc. calls, an internal snapshot which keeps some cached data and also pre-allocates some quota for immediate use (128KB currently), will be destroyed after 20 seconds. This is all done to improve performance.
However, it seems we need to tweak some of these constants or just switch dom.storage.snapshot_reusing
to false by default, I need to discuss with the team.
Reporter | ||
Comment 10•3 years ago
|
||
Ah, got it, thank you for the info. One of our sites has a localStorage item that gets set every few seconds, this probably keeps the snapshot from being destroyed.
Reporter | ||
Comment 11•3 years ago
|
||
Hi, any chance this issue or bug 1673276 & bug 1733054 are being tracked and looked into? Much appreciation and thanks in advance!
Comment 12•3 years ago
|
||
Yeah, we are working on a solution.
Reporter | ||
Comment 13•3 years ago
|
||
Awesome, that's great to hear, thank you!
Reporter | ||
Comment 14•3 years ago
|
||
Hi, just wanted to follow up, hoping for a sense on timing for when a solution will be available. Thank you!
Updated•3 years ago
|
Description
•