Skip to content

localStorage usage in unsupported environments #166

Description

@WarningImHack3r

Describe the bug

In environments where localStorage is not available (most notably when users disable browser storage altogether), using it throws a SecurityError.

Such exceptions are not handled/caught by mode-watcher, the first hit being the inlined setInitialMode function.

Reproduction

Any usage of the lib within a site when the browser setting about persistent storage is disabled

Logs

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

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions