I am testing an unsigned .xpi in Firefox ESR at the moment. For some reason on first install of a newly zipped .xpi my code doesn’t recognize the install and hence doesn’t run the block with the details.reason === ‘install’ check.
Here’s the code block
function handleStorageDefaults(details) {
const temp = details.temporary;
const install = (details.reason === 'install');
const update = (details.reason === 'update');
if (temp || install || update) {
/* Construct storage object */
const keys = {
alarm: '18:30:00',
filename: '',
bulkReload: 5,
reoccur: true,
append: true
}
/* Clear browser storage first on install or temp install or
update */
browser.storage.local.clear()
.then(() => console.log(`Storage cleared`),
error => console.error(error));
browser.storage.local.set(keys)
.then(() =>
{
/* Set defaults on localStorage object */
assignStorage(keys);
console.log('Storage defaults set');
/* Set default alarm for 6:30PM */
createAlarm(keys.alarm);
},
error => console.error(error)
);
}
}
Any help would be appreciated as to why the if block won’t run on first install. Thanks.