aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 6e41a190..4a8605e5 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -1319,17 +1319,26 @@ class Display extends EventDispatcher {
}
_updateMode() {
- const mode = sessionStorage.getItem('mode');
+ let mode = null;
+ try {
+ mode = sessionStorage.getItem('mode');
+ } catch (e) {
+ // Browsers can throw a SecurityError when cookie blocking is enabled.
+ }
this._setMode(mode, false);
}
_setMode(mode, save) {
if (mode === this._mode) { return; }
if (save) {
- if (mode === null) {
- sessionStorage.removeItem('mode');
- } else {
- sessionStorage.setItem('mode', mode);
+ try {
+ if (mode === null) {
+ sessionStorage.removeItem('mode');
+ } else {
+ sessionStorage.setItem('mode', mode);
+ }
+ } catch (e) {
+ // Browsers can throw a SecurityError when cookie blocking is enabled.
}
}
this._mode = mode;