Most client side local storage in MW is done via mw.storage and mw.storage.session which provide simple wrappers around localStorage and sessionStorage respectively, adding some commonly require features:
- Error suppression
- JSON encoding/decoding of objects
- Expiry (particularly important in the long-living localStorage), implemented in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/804591
Both storage systems have quotas of about 5-10MiB, which becomes problematic with use cases like ResourceLoader caching (mw.loader.store which regularly stores 1-2MiB), or document autosave (VE needs to store initial Parsoid HTML which can be several MiB, and the user could have several concurrent autosaves at any one time, same applies to wikitext autosave).
For this reason VE is still using sessionStorage (aka tab storage) for autosave, as this is less likely to ever have multiple documents and is typically short-lived.
More recently indexedDB has become widely available with much greater storage limits (typically on the order of GiB), and was used to provide a longer-lived autosave feature in the core wikitext editors e.g. 2010 wikitext editor (mediawiki.editRecovery).
To allow use of indexedDB in more places, this implementation (mediawiki.editRecovery) should be turned into a generic KV store, along the lines of mw.storage (although it will need to be async).
See also
Tasks mentioning indexeddb: https://phabricator.wikimedia.org/search/query/xc7H.gWgabNB/#R