Skip to content

addToLocalStorage should not fallback to cookies on exception #361

@eltoder

Description

@eltoder

Currently addToLocalStorage() catches exceptions from webStorage.setItem() and falls back to writing to cookies if an exception happened (code). This seems wrong:

  • It doesn't check self.defaultToCookie before doing so.
  • Since browserSupportsLocalStorage is true, there's no matching code in getFromLocalStorage() to read the saved value.

In practice this leads to the following problem: if the local storage limit is exceeded, the data starts being written to cookies, which quickly overflows the cookie size limits and causes 400.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions