Skip to content

Unhandled Promise rejection: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document #641

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

Closed
LeonardoDavinci opened this issue Sep 30, 2019 · 3 comments
Labels
bug For tagging faulty or unexpected behavior.

Comments

@LeonardoDavinci
Copy link

Describe the bug
When a user blocks a site from saving data, the whole angular app crashes when using the library.

Stackblitz example
Any app that uses the library, and has blocked the site from storing data in chrome.

To Reproduce

  1. Block the site from accessing data. Go to chrome://settings/content/cookies and add the domain in the block section.

Screenshot 2019-09-30 at 14 21 17

2. Reload the site

Expected behavior
Probably the library won't work without being able to save data, but at least it shouldn't crash.

Desktop (please complete the following information):

  • OS: Mac
  • Browser: chrome
  • Version: 77

Additional context
Unhandled Promise rejection: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document. ; Zone: ; Task: Promise.then ; Value: DOMException: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
at createDefaultStorage (http://localhost:4200/vendor.js:170856:5)
at _callFactory (http://localhost:4200/vendor.js:89741:20)
at _createProviderInstance (http://localhost:4200/vendor.js:89684:26)
at resolveNgModuleDep (http://localhost:4200/vendor.js:89628:21)
at _createClass (http://localhost:4200/vendor.js:89725:32)
at createProviderInstance (http://localhost:4200/vendor.js:89681:26)
at resolveNgModuleDep (http://localhost:4200/vendor.js:89628:21)
at NgModuleRef
.get (http://localhost:4200/vendor.js:90736:16)
at resolveDep (http://localhost:4200/vendor.js:91266:45)
at createClass (http://localhost:4200/vendor.js:91119:32) Error: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
at createDefaultStorage (http://localhost:4200/vendor.js:170856:5)
at _callFactory (http://localhost:4200/vendor.js:89741:20)
at _createProviderInstance (http://localhost:4200/vendor.js:89684:26)
at resolveNgModuleDep (http://localhost:4200/vendor.js:89628:21)
at _createClass (http://localhost:4200/vendor.js:89725:32)
at createProviderInstance (http://localhost:4200/vendor.js:89681:26)
at resolveNgModuleDep (http://localhost:4200/vendor.js:89628:21)
at NgModuleRef
.get (http://localhost:4200/vendor.js:90736:16)
at resolveDep (http://localhost:4200/vendor.js:91266:45)
at createClass (http://localhost:4200/vendor.js:91119:32)

@jeroenheijmans jeroenheijmans added the bug For tagging faulty or unexpected behavior. label Sep 30, 2019
@LeonardoDavinci
Copy link
Author

LeonardoDavinci commented Oct 21, 2019

Just found out that there is an easy fix. Just adding a try catch around the access of session- / localstorage. Because e.g. "undefined" != typeof sessionStorage already gives the security exception.

@manfredsteyer
Copy link
Owner

willl work in version 9.

@manibf
Copy link

manibf commented Dec 13, 2021

This issue still exist in latest version 12.1

To reproduce:

  • Disable third-party cookies on chrome
  • Access the application that is importing OAuthModule, through an iframe on a different domain

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For tagging faulty or unexpected behavior.
Projects
None yet
Development

No branches or pull requests

4 participants