localStorage is shared between ZIM files
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 93
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
I noticed this while working on openzim/mwoffliner#2483, which like MediaWiki itself uses the local storage to cache JavaScript modules for faster load times. This resulted in me loading JavaScript from different ZIM files of the same wiki and for some wikis even JS from a completely different wiki.
For the PR I solved this issue by adding a timestamp to the vary version check when loading from localStorage, but ultimately this seems like an issue that should be solved by the reader as getting unexpected data in localStorage from different ZIMs might cause all kinds of issues. The reader should probably clear the localStorage whenever a new ZIM file is getting loaded.
I did not test if this issue exists for other types of storage as well (session, cookies) and I didn't test it for other readers either. I would appreciate it if you could create follow-up issues for any other readers affected by this issue as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the reader entry point that loads a new ZIM and its localStorage handling. Reproduce switching between ZIM files and inspect whether cached JavaScript from the previous file remains; done means storage is isolated or cleared on load without cross-ZIM data leakage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100