Skip to content

Commit

Permalink
Pull request #731: AG-27774 Fix 'storage not initialized' error on ex…
Browse files Browse the repository at this point in the history
…tension install

Merge in ADGUARD-FILTERS/tsurlfilter from fix/AG-27774 to master

Squashed commit of the following:

commit f220ac5
Author: Vladimir Zhelvis <[email protected]>
Date:   Thu Nov 16 13:27:21 2023 +0300

    add fallback in app.isStarted getter
  • Loading branch information
zhelvis committed Nov 16, 2023
1 parent af27954 commit eb282f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/tswebextension/src/lib/mv2/background/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit eb282f3

Please sign in to comment.