1119 Privacy - Query Page and Dom.storage

implement memory storage for functionality in case of no storage

Signed-off-by: Chris Miceli <chrismiceli@outlook.com>
This commit is contained in:
Chris Miceli
2022-02-05 22:04:14 -06:00
parent 99c718296a
commit bb2934e243

View File

@@ -229,13 +229,20 @@ function setBsSelectDefaults() {
};
}
var backupStorage = {};
function stateSaveCallback(itemName, data) {
localStorage.setItem(itemName, JSON.stringify(data));
if (localStorage === null) {
backupStorage[itemName] = JSON.stringify(data);
} else {
localStorage.setItem(itemName, JSON.stringify(data));
}
}
function stateLoadCallback(itemName) {
// Receive previous state from client's local storage area
var data = localStorage ? localStorage.getItem(itemName) : null;
var data =
localStorage === null ? backupStorage[itemName] || null : localStorage.getItem(itemName);
// Return if not available
if (data === null) {
return null;