Clear cache on relaod
This commit is contained in:
@@ -647,6 +647,12 @@ function serializeTabEntries(state) {
|
||||
.map(serializeEntry);
|
||||
}
|
||||
|
||||
async function clearAllCapturedState() {
|
||||
TAB_CAPTURED.clear();
|
||||
FULL_URL_BY_SAMPLE.clear();
|
||||
await browser.storage.local.remove(HISTORY_KEY);
|
||||
}
|
||||
|
||||
browser.runtime.onMessage.addListener((message, sender) => {
|
||||
if (!message || typeof message.type !== "string") {
|
||||
return undefined;
|
||||
@@ -724,6 +730,10 @@ browser.runtime.onMessage.addListener((message, sender) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (message.type === "CLEAR_CAPTURED_STATE") {
|
||||
return clearAllCapturedState().then(() => ({ ok: true }));
|
||||
}
|
||||
|
||||
if (message.type === "DOWNLOAD_ENTRY") {
|
||||
return resolveAndDownloadEntry(message.entry)
|
||||
.then(async (result) => {
|
||||
@@ -864,3 +874,7 @@ browser.webNavigation.onCommitted.addListener((details) => {
|
||||
}
|
||||
maybeClearTabState(details.tabId);
|
||||
});
|
||||
|
||||
browser.runtime.onStartup.addListener(() => {
|
||||
void clearAllCapturedState();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user