Minor code review

This commit is contained in:
Raymond Hill 2024-04-09 20:05:53 -04:00
parent e3247cb48c
commit 581c2824d0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 12 additions and 18 deletions

View File

@ -19,26 +19,23 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* globals browser */
'use strict';
/******************************************************************************/ /******************************************************************************/
import µb from './background.js';
import logger from './logger.js';
import { onBroadcast } from './broadcast.js';
import { redirectEngine as reng } from './redirect-engine.js';
import { sessionFirewall } from './filtering-engines.js';
import { MRUCache } from './mrucache.js';
import { ScriptletFilteringEngine } from './scriptlet-filtering-core.js';
import { import {
domainFromHostname, domainFromHostname,
entityFromDomain, entityFromDomain,
hostnameFromURI, hostnameFromURI,
} from './uri-utils.js'; } from './uri-utils.js';
import { MRUCache } from './mrucache.js';
import { ScriptletFilteringEngine } from './scriptlet-filtering-core.js';
import logger from './logger.js';
import { onBroadcast } from './broadcast.js';
import { redirectEngine as reng } from './redirect-engine.js';
import { sessionFirewall } from './filtering-engines.js';
import µb from './background.js';
/******************************************************************************/ /******************************************************************************/
const contentScriptRegisterer = new (class { const contentScriptRegisterer = new (class {
@ -262,15 +259,13 @@ export class ScriptletFilteringEngineEx extends ScriptletFilteringEngine {
reset() { reset() {
super.reset(); super.reset();
this.warSecret = vAPI.warSecret.long(this.warSecret); this.warSecret = vAPI.warSecret.long(this.warSecret);
this.scriptletCache.reset(); this.clearCache();
contentScriptRegisterer.reset();
} }
freeze() { freeze() {
super.freeze(); super.freeze();
this.warSecret = vAPI.warSecret.long(this.warSecret); this.warSecret = vAPI.warSecret.long(this.warSecret);
this.scriptletCache.reset(); this.clearCache();
contentScriptRegisterer.reset();
} }
clearCache() { clearCache() {
@ -290,8 +285,7 @@ export class ScriptletFilteringEngineEx extends ScriptletFilteringEngine {
} }
if ( this.scriptletCache.resetTime < reng.modifyTime ) { if ( this.scriptletCache.resetTime < reng.modifyTime ) {
this.warSecret = vAPI.warSecret.long(this.warSecret); this.clearCache();
this.scriptletCache.reset();
} }
let scriptletDetails = this.scriptletCache.lookup(hostname); let scriptletDetails = this.scriptletCache.lookup(hostname);