Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle inaccessible localStorage gracefully #10

Merged

Conversation

weyert
Copy link
Contributor

@weyert weyert commented Dec 5, 2021

…Node

Internally in jsdom has a getter function defined for localStorage
that can in some circumstances throw a runtime error that is not handled
by the package

The code has changed to use a function to qeury whether localStorage is
available in the runtime context. If accessing localStorage global throws
an error it returns an error otherwise true

fixes #9

…Node

Internally in `jsdom` has a getter function defined for `localStorage`
that can in some circumstances throw a runtime error that is not handled
by the package

The code has changed to use a function to qeury whether `localStorage` is
available in the runtime context. If accessing `localStorage` global throws
an error it returns an error otherwise `true`

fixes mswjs#9
@kettanaito kettanaito force-pushed the avoid-using-constant-for-localstorage-support branch from 9424964 to 2b7e183 Compare January 19, 2022 13:42
@kettanaito kettanaito changed the title fix: cover the case were accessing localStorage can throw error in … fix: gracefully handles inaccessible localStorage Jan 19, 2022
@kettanaito kettanaito changed the title fix: gracefully handles inaccessible localStorage fix: handle inaccessible localStorage gracefully Jan 19, 2022
Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing this, @weyert! Welcome to contributors! 🎉
Looking forward to working more with you.

@kettanaito kettanaito merged commit 80abf96 into mswjs:main Jan 19, 2022
@github-actions
Copy link

🎉 This PR is included in version 0.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessing localStorage throws error in CookieStore
3 participants