Skip to content

Commit 97f0660

Browse files
committed
Initialize incogino.js in background.js
1 parent c020fed commit 97f0660

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

chromium/background.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
const rules = require('./rules'),
66
store = require('./store'),
7+
incognito = require('./incognito'),
78
util = require('./util');
89

910

@@ -13,6 +14,7 @@ async function initialize() {
1314
await store.initialize();
1415
await initializeStoredGlobals();
1516
await all_rules.initialize(store);
17+
await incognito.onIncognitoDestruction(destroy_caches);
1618

1719
// Send a message to the embedded webextension bootstrap.js to get settings to import
1820
chrome.runtime.sendMessage("import-legacy-data", import_settings);
@@ -607,6 +609,17 @@ async function import_settings(settings) {
607609
}
608610
}
609611

612+
/**
613+
* Clear any cache/ blacklist we have.
614+
*/
615+
function destroy_caches() {
616+
util.log(util.DBUG, "Destroying caches.");
617+
all_rules.cookieHostCache.clear();
618+
all_rules.ruleCache.clear();
619+
rules.settings.domainBlacklist.clear();
620+
urlBlacklist.clear();
621+
}
622+
610623
Object.assign(exports, {
611624
all_rules,
612625
urlBlacklist

0 commit comments

Comments
 (0)