mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-02 21:12:02 +08:00
Fix localStorage check when embedded in iframe (firefox)
This commit is contained in:
parent
6e20d5fccc
commit
9f867e7c16
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,13 @@ const TIME_KEY = '__rlT';
|
|||
*/
|
||||
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
|
||||
s = window[storageName],
|
||||
|
@ -28,6 +34,7 @@ export function isStorageSupported(storageName)
|
|||
catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue