I'm encountering a very strange problem whereby the state information within a Chrome extension background.js page is not persisting Chrome sessions for a specific user. By Chrome sessions I mean closing and reopening Chrome.
All I am storing in the background.js is an array of key value pairs, that I am updating and reading as follows.
//background.js
var settings = [];
function (request, sender, sendResponse) {
//SAVE
if (request.cmd == "save") {
settings[request.data.key] = request.data.value;
}
//RETRIEVE
if (request.cmd == "load") {
var myVal = settings[request.data.key];
sendResponse(myVal);
}
}
I did notice a setting within Chrome (advanced settings), which I can confirm is invoked for this particular user.
Continue running background apps when Google Chrome has closed.
What else could cause the background.js to lose state information between Chrome sessions?