File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55const 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+
610623Object . assign ( exports , {
611624 all_rules,
612625 urlBlacklist
You can’t perform that action at this time.
0 commit comments