Skip to content

Commit

Permalink
Skip matching when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmod committed Nov 20, 2024
1 parent 4ad49a1 commit b63b226
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/background/adblocker.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ function injectStyles(styles, tabId, frameId) {
}

async function injectCosmetics(details, config) {
const isBootstrap = config.bootstrap;
const scriptletsOnly = Boolean(config.scriptletsOnly);

try {
setup.pending && (await setup.pending);
} catch (e) {
Expand All @@ -309,6 +312,8 @@ async function injectCosmetics(details, config) {
const domain = parsed.domain || '';
const hostname = parsed.hostname || '';

if (scriptletsOnly && contentScripts.isRegistered(hostname)) return;

if (isPaused(options, hostname)) return;

const tabHostname = tabStats.get(tabId)?.hostname;
Expand All @@ -317,8 +322,6 @@ async function injectCosmetics(details, config) {
}

const engine = engines.get(engines.MAIN_ENGINE);
const isBootstrap = config.bootstrap;
const scriptletsOnly = Boolean(config.scriptletsOnly);

{
const cosmetics = engine.getCosmeticsFilters({
Expand Down

0 comments on commit b63b226

Please sign in to comment.