mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 01:50:28 +00:00
Fix issue with localStorage error on Firefox
Firefox raises an error if window.localStorage is accessed when cookies are disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=771890
This commit is contained in:
parent
465f4ac469
commit
3351ae7e29
@ -96,8 +96,11 @@ exports.getBoundingPageRect = function(element) {
|
||||
Saves a named password in the browser
|
||||
*/
|
||||
exports.savePassword = function(name,password) {
|
||||
if(window.localStorage) {
|
||||
localStorage.setItem("tw5-password-" + name,password);
|
||||
try {
|
||||
if(window.localStorage) {
|
||||
localStorage.setItem("tw5-password-" + name,password);
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -105,7 +108,11 @@ exports.savePassword = function(name,password) {
|
||||
Retrieve a named password from the browser
|
||||
*/
|
||||
exports.getPassword = function(name) {
|
||||
return window.localStorage ? localStorage.getItem("tw5-password-" + name) : "";
|
||||
try {
|
||||
return window.localStorage ? localStorage.getItem("tw5-password-" + name) : "";
|
||||
} catch(e) {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user