diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-05-30 15:07:41 +0200 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-05-30 15:07:41 +0200 |
| commit | 6a41c0b7a0c0f8299a86e5d33e7008ced3911924 (patch) | |
| tree | d7a16319698c9cd5a2c7c449ed4bf773c9018204 /pattern.c | |
| parent | b6c842a28cf6597df063fcff35079c3e3982381e (diff) | |
| download | puzzles-6a41c0b7a0c0f8299a86e5d33e7008ced3911924.zip puzzles-6a41c0b7a0c0f8299a86e5d33e7008ced3911924.tar.gz puzzles-6a41c0b7a0c0f8299a86e5d33e7008ced3911924.tar.bz2 puzzles-6a41c0b7a0c0f8299a86e5d33e7008ced3911924.tar.xz | |
js: handle exceptions when accessing localStorage
Trying to access window.localStorage will generate an exception if the
local storage is for some reason inaccessible. This can be
demonstrated in Firefox by configuring it to block a site from using
site data. Writing to local storage might also cause an exception if,
for instance, the quota of data for a site is exceeded.
If an exception is raised while loading preferences we log the fact
but don't make any report to the user, behaving as if no preferences
were found. This avoids annoying the user on every visit to a puzzle
page if they're not trying to use preferences.
If something goes wrong when saving, we do currently report that to
the user in an alert box. This seems reasonable since it's in
response to an explicit user action.
Diffstat (limited to 'pattern.c')
0 files changed, 0 insertions, 0 deletions