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

DOMException: Failed to read the 'sessionStorage' #8934

Closed
fasenderos opened this issue Sep 1, 2022 · 1 comment · Fixed by #8935
Closed

DOMException: Failed to read the 'sessionStorage' #8934

fasenderos opened this issue Sep 1, 2022 · 1 comment · Fixed by #8935

Comments

@fasenderos
Copy link
Contributor

Type of issue

Bug

Description

Running prebid.js in a safe frame results in the following error

DOMException: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document

I think the problem was introduced here

Modifying the loadSession function as below solves that problem

export function loadSession() {
  let storage = null;
  try {
    storage = window.sessionStorage;
  } catch (e) {}

  if (storage !== null) {
    let debugging = ctl;
    let config = null;
    try {
      config = storage.getItem(DEBUG_KEY);
    } catch (e) {}
    if (config !== null) {
      // just make sure the module runs; it will take care of parsing the config (and disabling itself if necessary)
      debugging.enable();
    }
  }
}
@robertrmartinez
Copy link
Collaborator

@dgirardi @fasenderos Should we also make a similar change to the debugging module files as well?

Guess since it is "debugging only mode" not a huge deal, but if you are testing something and load the lib in incognito or something it may throw errors?

https://github.com/prebid/Prebid.js/blob/master/modules/debugging/debugging.js#L34

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

Successfully merging a pull request may close this issue.

2 participants