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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update store.browser.ts to handle window.localStorage access error #527

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BenMuschol-at
Copy link

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

馃悰 Bug fix

  • What is the current behavior? (You can also link to an open issue here)

window.localStorage crashes in an iframe with an Access Denied error. The code is already resilient to localStorage not existing, it's just not resilient to localStorage throwing an error. This PR includes a minor code structure change so that it handles this case.

  • What is the new behavior (if this is a feature change)?

Does not crash in iframes, properly falls back to other storage

  • Other information:

@heiglandreas
Copy link

heiglandreas commented Nov 14, 2023

This is a vital change for our use-case as well.

Steps to reproduce:

In Firefox 119 set the browser privacy to "Custom" and set blocked "Cookies" to "All cross-site cookies".

grafik

Embed the filestack-code in a website that is then embedded in an iFrame on a different domain. Now accessing the localStorage will fail with error "Error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document" or similar.

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