Category: documentation
Severity: patch
File(s): popup.js (getStoredDomains)
Description
The getStoredDomains helper resolves storage with a fallback to an empty array when the stored value is not an array. This is an intentional defensive pattern, but there is no inline comment explaining why the fallback exists (e.g. first-run, storage corruption, or migration). Without this context, future contributors may remove or change the fallback unintentionally.
Problematic code example
const getStoredDomains = async () => {
const result = await browser.storage.sync.get(STORAGE_KEY);
const stored = result[STORAGE_KEY];
return Array.isArray(stored) ? stored : [];
};
Suggested fix
const getStoredDomains = async () => {
const result = await browser.storage.sync.get(STORAGE_KEY);
const stored = result[STORAGE_KEY];
// Fall back to an empty array on first run or if the stored value is corrupted / missing.
return Array.isArray(stored) ? stored : [];
};
Acceptance criteria
Category: documentation
Severity: patch
File(s):
popup.js(getStoredDomains)Description
The
getStoredDomainshelper resolves storage with a fallback to an empty array when the stored value is not an array. This is an intentional defensive pattern, but there is no inline comment explaining why the fallback exists (e.g. first-run, storage corruption, or migration). Without this context, future contributors may remove or change the fallback unintentionally.Problematic code example
Suggested fix
Acceptance criteria