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

access denied error thrown when cookies disabled #240

Open
bpcrao opened this issue Sep 22, 2021 · 1 comment
Open

access denied error thrown when cookies disabled #240

bpcrao opened this issue Sep 22, 2021 · 1 comment

Comments

@bpcrao
Copy link

bpcrao commented Sep 22, 2021

Environment:
Chrome browser on MacOS

Reproduce Steps

  1. In incognito window mode of chrome browser
  2. toggle "disable cookies" button
  3. try loading the script , it fails accessing localStorage since the localStorage property exists but access is restricted

the handling in the current code is checking if property exists instead it should gracefully handle it by catching the exception and polyfill it.

Error
Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

@ffxsam
Copy link

ffxsam commented Nov 8, 2021

It appears this happens even if you don't change the cookie settings. I'm wondering if Chrome made localstorage access more strict in a recent update. This is actually breaking our application in production.

This is the culprit: https://github.com/eclipse/paho.mqtt.javascript/blob/f5859463aba9a9b7c19f99ab7c4849a723f8d832/src/paho-mqtt.js#L109

That needs to be wrapped in a try/catch and gracefully handled.

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

No branches or pull requests

2 participants