mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-25 07:16:21 +08:00
Merge pull request #1648 from albertmatyi/patch-1
Fix localStorage check when embedded in iframe (firefox)
This commit is contained in:
commit
1bd4cdbd2e
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,13 @@ const TIME_KEY = '__rlT';
|
||||||
*/
|
*/
|
||||||
export function isStorageSupported(storageName)
|
export function isStorageSupported(storageName)
|
||||||
{
|
{
|
||||||
if (storageName in window && window[storageName] && window[storageName].setItem)
|
let storageIsAvailable = false;
|
||||||
|
try {
|
||||||
|
storageIsAvailable = storageName in window && window[storageName] && window[storageName].setItem;
|
||||||
|
}
|
||||||
|
catch(e) {} // at: window[storageName] firefox throws SecurityError: The operation is insecure. when in iframe
|
||||||
|
|
||||||
|
if (storageIsAvailable)
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
s = window[storageName],
|
s = window[storageName],
|
||||||
|
@ -28,6 +34,7 @@ export function isStorageSupported(storageName)
|
||||||
catch (e) {} // eslint-disable-line no-empty
|
catch (e) {} // eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue