diff --git a/packages/tswebextension/src/lib/mv2/background/app.ts b/packages/tswebextension/src/lib/mv2/background/app.ts index 869dd775e..74ed7b1d2 100644 --- a/packages/tswebextension/src/lib/mv2/background/app.ts +++ b/packages/tswebextension/src/lib/mv2/background/app.ts @@ -53,6 +53,13 @@ MessageHandlerMV2 * @returns True if app started, else false. */ public get isStarted(): boolean { + // TODO: Remove this check after moving call of storage initialization in extension code. + // Check this flag before access storage values, because engine methods + // can be triggered before initialization by extension `onCheckRequestFilterReady` method. + if (!appContext.isStorageInitialized) { + return false; + } + return appContext.isAppStarted; } diff --git a/packages/tswebextension/src/lib/mv2/background/engine-api.ts b/packages/tswebextension/src/lib/mv2/background/engine-api.ts index f2bccd1ba..d6cb60c68 100644 --- a/packages/tswebextension/src/lib/mv2/background/engine-api.ts +++ b/packages/tswebextension/src/lib/mv2/background/engine-api.ts @@ -48,6 +48,7 @@ export class EngineApi { * @returns True if filtering is enabled, otherwise returns false. */ public get isFilteringEnabled(): boolean { + // TODO: Remove this check after moving call of storage initialization in extension code. // Check this flag before access storage values, because engine methods // can by triggered before initialization by content script requests. if (!this.appContext.isStorageInitialized) {