diff --git a/packages/tswebextension/src/lib/mv2/background/tabs/tabs-cosmetic-injector.ts b/packages/tswebextension/src/lib/mv2/background/tabs/tabs-cosmetic-injector.ts index 74643c017..346c7389d 100644 --- a/packages/tswebextension/src/lib/mv2/background/tabs/tabs-cosmetic-injector.ts +++ b/packages/tswebextension/src/lib/mv2/background/tabs/tabs-cosmetic-injector.ts @@ -107,10 +107,12 @@ export class TabsCosmeticInjector { */ const TAB_PROCESSING_THRESHOLD_MS = 10000; + // TODO: Instead of this, it’s better to use the runtime.onStartup and runtime.onInstalled + // events to inject cosmetics once during the extension's initialization and browser startup. + // However, this would require big refactoring of the extension. /** * This condition prevents applying cosmetic rules to the tab multiple times. * Applying them once after the extension's initialization is sufficient. - * TODO: it would be better to use chrome.runtime.onStartup and chrome.runtime.onInstalled events. */ if (appContext.startTimeMs && Date.now() - appContext.startTimeMs > TAB_PROCESSING_THRESHOLD_MS) { return; diff --git a/packages/tswebextension/src/lib/mv3/tabs/tabs-cosmetic-injector.ts b/packages/tswebextension/src/lib/mv3/tabs/tabs-cosmetic-injector.ts index fd23298ff..df2695767 100644 --- a/packages/tswebextension/src/lib/mv3/tabs/tabs-cosmetic-injector.ts +++ b/packages/tswebextension/src/lib/mv3/tabs/tabs-cosmetic-injector.ts @@ -89,10 +89,12 @@ export class TabsCosmeticInjector { */ const TAB_PROCESSING_THRESHOLD_MS = 10000; + // TODO: Instead of this, it’s better to use the runtime.onStartup and runtime.onInstalled + // events to inject cosmetics once during the extension's initialization and browser startup. + // However, this would require big refactoring of the extension. /** * This condition prevents applying cosmetic rules to the tab multiple times. * Applying them once after the extension's initialization is enough. - * TODO: it would be better to use chrome.runtime.onStartup and chrome.runtime.onInstalled events. */ if (appContext.startTimeMs && currentTime - appContext.startTimeMs > TAB_PROCESSING_THRESHOLD_MS) { return;