-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fixes an issue where default storage was read-only #172
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ var storageUtil = {}; | |
// https://connect.microsoft.com/IE/Feedback/Details/1496040 | ||
storageUtil.browserHasLocalStorage = function() { | ||
try { | ||
if (storageUtil.getLocalStorage()) { | ||
var storage = storageUtil.getLocalStorage(); | ||
if (storageUtil.testStorage(storage)) { | ||
return true; | ||
} else { | ||
return false; | ||
|
@@ -34,7 +35,8 @@ storageUtil.browserHasLocalStorage = function() { | |
|
||
storageUtil.browserHasSessionStorage = function() { | ||
try { | ||
if (storageUtil.getSessionStorage()) { | ||
var storage = storageUtil.getSessionStorage(); | ||
if (storageUtil.testStorage(storage)) { | ||
return true; | ||
} else { | ||
return false; | ||
|
@@ -73,4 +75,15 @@ storageUtil.getCookieStorage = function() { | |
}; | ||
}; | ||
|
||
storageUtil.testStorage = function(storage) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wonder if it's worth to check null-able of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that as well. Attempting to call |
||
var key = 'okta-test-storage'; | ||
try { | ||
storage.setItem(key, key); | ||
storage.removeItem(key); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
|
||
module.exports = storageUtil; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: return storageUtil.testStorage(storage)