Skip to content

Commit bfba9cf

Browse files
authored
Merge pull request #364 from ezzak/tab_id_storage_changes
Maintain violations when tab ID is reused
2 parents 51dc772 + 6904eae commit bfba9cf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/js/background/historyManager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,19 @@ export async function upsertInvalidRecord(
6767
const tabIDKey = String(tabID);
6868
const entry = await chrome.storage.local.get(tabIDKey);
6969

70+
const violations = TAB_TO_VIOLATING_SRCS.get(tabID) ?? new Set();
71+
7072
if (Object.keys(entry).length !== 0) {
7173
creationTime = entry[tabIDKey].creationTime;
74+
entry[tabIDKey].violations.forEach((violation: Violation) => {
75+
violations.add(violation);
76+
});
7277
}
7378

7479
return chrome.storage.local.set({
7580
[tabIDKey]: {
7681
creationTime,
77-
violations: Array.from(TAB_TO_VIOLATING_SRCS.get(tabID) ?? new Set()),
82+
violations: Array.from(violations),
7883
url: tab.url,
7984
},
8085
});

0 commit comments

Comments
 (0)