This repository was archived by the owner on Jun 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,18 @@ const emitBlockedEvent = (request: Request) => {
5656} ;
5757
5858let adblockRunning = false ;
59+ let adblockInitialized = false ;
5960
6061export const runAdblockService = async ( ses : any ) => {
61- if ( ! engine ) {
62+ if ( ! adblockInitialized ) {
63+ adblockInitialized = true ;
6264 await loadFilters ( ) ;
6365 }
6466
67+ if ( adblockInitialized && ! engine ) {
68+ return ;
69+ }
70+
6571 if ( adblockRunning ) return ;
6672
6773 adblockRunning = true ;
@@ -75,8 +81,9 @@ export const runAdblockService = async (ses: any) => {
7581export const stopAdblockService = ( ses : any ) => {
7682 if ( ! adblockRunning ) return ;
7783
84+ adblockRunning = false ;
85+
7886 if ( engine ) {
7987 engine . disableBlockingInSession ( ses ) ;
80- adblockRunning = false ;
8188 }
8289} ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const queryTabs = async (queryInfo: any): Promise<chrome.tabs.Tab[]> => {
1515 const readProperty = ( obj : any , prop : string ) => obj [ prop ] ;
1616 const data : chrome . tabs . Tab [ ] = await ipcRenderer . invoke ( `api-tabs-query` ) ;
1717
18- return data . filter ( tab => {
18+ return data . filter ( ( tab ) => {
1919 for ( const key in queryInfo ) {
2020 const tabProp = readProperty ( tab , key ) ;
2121 const queryInfoProp = readProperty ( queryInfo , key ) ;
@@ -118,7 +118,7 @@ const changeBrowserActionInfo = async (
118118 } ;
119119
120120 if ( typeof args [ 0 ] === 'object' ) {
121- tabs . getCurrent ( tab => {
121+ tabs . getCurrent ( ( tab ) => {
122122 insertCSS ( tab . id , args [ 0 ] , args [ 1 ] ) ;
123123 } ) ;
124124 } else if ( typeof args [ 0 ] === 'number' ) {
@@ -178,7 +178,7 @@ const changeBrowserActionInfo = async (
178178 onClicked : new IpcEvent ( 'browserAction' , 'onClicked' ) ,
179179 } ;
180180
181- BROWSER_ACTION_METHODS . forEach ( method => {
181+ BROWSER_ACTION_METHODS . forEach ( ( method ) => {
182182 chrome . browserAction [ method ] = async ( details : any , cb : any ) => {
183183 if ( details . imageData ) {
184184 return ;
You can’t perform that action at this time.
0 commit comments