@@ -317,13 +317,14 @@ function fileAccessSchemeExtPageSwitch(){
317317 fileAccessSchemeExtPage = true ;
318318}
319319async function blockingWindow ( url , callback ) {
320+ await logData ( "info" , "BlockingWindow Initilising!" ) ;
320321 return chrome . windows . create ( {
321322 url : url ,
322323 type : "popup" ,
323324 state : "fullscreen"
324- } , callback ) . then ( async ( ) => {
325+ } , callback ) /* .then(async() => {
325326 logData("info","BlockingWindow Initilised!");
326- } )
327+ })*/
327328}
328329function relaunchEnforceWindow ( windowId ) {
329330 let timenow = new Date ( ) . getTime ( ) ;
@@ -558,19 +559,23 @@ async function handleExternalAction(sendResponse, func, args){
558559
559560
560561/*---Main Startup---*/
561- function initExtension ( ) {
562- if ( typeof syncEnrollmentInterval == 'undefined' ) {
563- syncEnrollment ( ) ;
564- let syncEnrollmentInterval = setInterval ( syncEnrollment , 30000 ) ;
565- }
566- if ( typeof syncEnrollmentInterval == 'undefined' ) {
567- let setBlockedSitesInterval = setBlockedSitesLoop ( ) ;
568- }
569- if ( typeof permissionsCheckInterval == 'undefined' ) {
570- checkPermissions ( ) ;
571- let permissionsCheckInterval = setInterval ( checkPermissions , 1000 ) ;
562+ async function initExtension ( ) {
563+ let startupInfo = chrome . storage . session . get ( 'initStarted' )
564+ if ( typeof startupInfo . initStarted == 'undefined' ) {
565+ await chrome . storage . session . set ( { initStarted : true } )
566+ if ( typeof syncEnrollmentInterval == 'undefined' ) {
567+ syncEnrollment ( ) ;
568+ let syncEnrollmentInterval = setInterval ( syncEnrollment , 30000 ) ;
569+ }
570+ if ( typeof syncEnrollmentInterval == 'undefined' ) {
571+ let setBlockedSitesInterval = setBlockedSitesLoop ( ) ;
572+ }
573+ if ( typeof permissionsCheckInterval == 'undefined' ) {
574+ checkPermissions ( ) ;
575+ let permissionsCheckInterval = setInterval ( checkPermissions , 1000 ) ;
576+ }
577+ return logData ( "info" , "EXTENSION INITILISATION COMPLETE" ) ;
572578 }
573- return logData ( "info" , "EXTENSION INITILISATION COMPLETE" ) ;
574579}
575580
576581if ( typeof window == 'undefined' ) { //The javascript equivilant of `if __name__ == '__main__':` in python
@@ -601,4 +606,5 @@ if (typeof window == 'undefined') { //The javascript equivilant of `if __name__
601606
602607 chrome . runtime . onStartup . addListener ( initExtension ) ;
603608 chrome . runtime . onInstalled . addListener ( initExtension ) ;
609+ initExtension ( ) ;
604610}
0 commit comments