diff options
-rw-r--r-- | src/lib/SyncMessage.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/SyncMessage.js b/src/lib/SyncMessage.js index c889b2c..698822c 100644 --- a/src/lib/SyncMessage.js +++ b/src/lib/SyncMessage.js @@ -253,10 +253,16 @@ let r = new XMLHttpRequest(); let result; let key = `${ENDPOINT_PREFIX}`; - let reloaded = sessionStorage.getItem(key) === "reloaded"; - if (reloaded) { - sessionStorage.removeItem(key); - console.log("Syncmessage attempt aftert reloading page."); + let reloaded; + try { + reloaded = sessionStorage.getItem(key) === "reloaded"; + if (reloaded) { + sessionStorage.removeItem(key); + console.log("Syncmessage attempt aftert reloading page."); + } + } catch (e) { + // we can't access sessionStorage: let's act as we've already reloaded + reloaded = true; } for (let attempts = 3; attempts-- > 0;) { try { @@ -268,7 +274,7 @@ console.error(`syncMessage error in ${document.URL}: ${e.message} (response ${r.responseText}, remaining attempts ${attempts})`); if (attempts === 0) { if (reloaded) { - console.log("Already reloaded, giving up.") + console.log("Already reloaded or no sessionStorage, giving up.") break; } sessionStorage.setItem(key, "reloaded"); |