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

Handle the case of no-access-to-localStorage. #76

Merged
merged 1 commit into from
May 28, 2014

Conversation

davidbau
Copy link
Member

Prevent visible exceptions from being thrown when window.localStorage access is prohibited.

if (!specialowner()) return false;
try {
if (!window.localStorage) return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this need to get moved into the try/catch? Why didn't it work outside like it was before? And why didn't the try catch just deal with the inability to access localStorage?

@davidbau
Copy link
Member Author

It turns out window.localStorage already returns an object which can be prohibited - you don't need to dereference into the storage object to get the exception - it's enough just to get the outer object itself. So even writing (!window.localStorage) was enough to get the security exception.

@davidbau
Copy link
Member Author

... In practice, this was occurring when running frame.pencilcode.net inside a frame where some security policy about localStorage access is applying.

@theanandramakrishna
Copy link
Contributor

ok. I'm merging it now.

theanandramakrishna added a commit that referenced this pull request May 28, 2014
Handle the case of no-access-to-localStorage.
@theanandramakrishna theanandramakrishna merged commit 40ec6e3 into master May 28, 2014
@davidbau davidbau deleted the nolocalstorage branch June 30, 2014 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants