SessionStorage exception when blocking cookies #34512
Labels
good first issue
Issue that doesn't require previous experience with Gatsby
help wanted
Issue with a clear description that the community can help with.
topic: core
Relates to Gatsby's core (e.g. page loading, reporter, state machine)
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
Through chrome (probably other browsers as well), users can disable cookies which will cause sessionStorage/localStorage to also throw an exception when accessed. Currently in Gatsby there are places where this is left unchecked, the offending code is here: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/production-app.js#L187-L200
This is actually catered for in the react-router-scroll package, which checks for an exception: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-react-router-scroll/src/session-storage.ts#L9
Potentially this could be extracted and reused as an all purpose function.
Reproduction Link
https://github.com/gatsbyjs/gatsby
Steps to Reproduce
gatsby build
gatsby serve
Expected Result
No exceptions are raised, using sessionStorage should be an enhancement not a given.
Actual Result
Security Exception is raised
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: