@@ -9,6 +9,8 @@ const startUrl = args[2] || 'https://www.google.com';
99
1010// This must be called before app.ready
1111app . commandLine . appendSwitch ( 'remote-debugging-port' , cdpPort ) ;
12+ app . commandLine . appendSwitch ( 'password-store' , 'basic' ) ;
13+ app . commandLine . appendSwitch ( 'use-mock-keychain' ) ;
1214
1315console . log ( '[ELECTRON BROWSER] Starting with:' ) ;
1416console . log ( ' Chrome version:' , process . versions . chrome ) ;
@@ -36,8 +38,14 @@ app.whenReady().then(async () => {
3638
3739 // Check command line switches
3840 console . log ( '[ELECTRON BROWSER] Command line switches:' ) ;
39- console . log ( ' user-data-dir:' , app . commandLine . getSwitchValue ( 'user-data-dir' ) ) ;
40- console . log ( ' remote-debugging-port:' , app . commandLine . getSwitchValue ( 'remote-debugging-port' ) ) ;
41+ console . log (
42+ ' user-data-dir:' ,
43+ app . commandLine . getSwitchValue ( 'user-data-dir' )
44+ ) ;
45+ console . log (
46+ ' remote-debugging-port:' ,
47+ app . commandLine . getSwitchValue ( 'remote-debugging-port' )
48+ ) ;
4149
4250 // Log partition session info
4351 const userLoginSession = session . fromPartition ( 'persist:user_login' ) ;
@@ -46,7 +54,12 @@ app.whenReady().then(async () => {
4654 console . log ( ' Session storage path:' , userLoginSession . getStoragePath ( ) ) ;
4755
4856 // Check if Cookies file exists
49- const cookiesPath = path . join ( app . getPath ( 'userData' ) , 'Partitions' , 'user_login' , 'Cookies' ) ;
57+ const cookiesPath = path . join (
58+ app . getPath ( 'userData' ) ,
59+ 'Partitions' ,
60+ 'user_login' ,
61+ 'Cookies'
62+ ) ;
5063 console . log ( '[ELECTRON BROWSER] Cookies path:' , cookiesPath ) ;
5164 console . log ( '[ELECTRON BROWSER] Cookies exists:' , fs . existsSync ( cookiesPath ) ) ;
5265 if ( fs . existsSync ( cookiesPath ) ) {
@@ -60,8 +73,8 @@ app.whenReady().then(async () => {
6073 webPreferences : {
6174 nodeIntegration : true ,
6275 contextIsolation : false ,
63- webviewTag : true
64- }
76+ webviewTag : true ,
77+ } ,
6578 } ) ;
6679
6780 // Create navigation bar and webview HTML
@@ -305,9 +318,14 @@ app.whenReady().then(async () => {
305318 setInterval ( async ( ) => {
306319 try {
307320 const cookies = await userLoginSession . cookies . get ( { } ) ;
308- console . log ( '[ELECTRON BROWSER] Current cookies count:' , cookies . length ) ;
321+ console . log (
322+ '[ELECTRON BROWSER] Current cookies count:' ,
323+ cookies . length
324+ ) ;
309325 if ( cookies . length > 0 ) {
310- console . log ( '[ELECTRON BROWSER] Cookie domains:' , [ ...new Set ( cookies . map ( c => c . domain ) ) ] ) ;
326+ console . log ( '[ELECTRON BROWSER] Cookie domains:' , [
327+ ...new Set ( cookies . map ( ( c ) => c . domain ) ) ,
328+ ] ) ;
311329 }
312330 } catch ( error ) {
313331 console . error ( '[ELECTRON BROWSER] Failed to get cookies:' , error ) ;
@@ -327,20 +345,34 @@ app.whenReady().then(async () => {
327345
328346 // Log cookies before flush
329347 const cookiesBeforeFlush = await userLoginSession . cookies . get ( { } ) ;
330- console . log ( '[ELECTRON BROWSER] Cookies count before flush:' , cookiesBeforeFlush . length ) ;
348+ console . log (
349+ '[ELECTRON BROWSER] Cookies count before flush:' ,
350+ cookiesBeforeFlush . length
351+ ) ;
331352
332353 // Flush storage
333354 console . log ( '[ELECTRON BROWSER] Flushing storage data...' ) ;
334355 await userLoginSession . flushStorageData ( ) ;
335356 console . log ( '[ELECTRON BROWSER] Storage data flushed successfully' ) ;
336357
337358 // Check cookies file after flush
338- const cookiesPath = path . join ( app . getPath ( 'userData' ) , 'Partitions' , 'user_login' , 'Cookies' ) ;
359+ const cookiesPath = path . join (
360+ app . getPath ( 'userData' ) ,
361+ 'Partitions' ,
362+ 'user_login' ,
363+ 'Cookies'
364+ ) ;
339365 if ( fs . existsSync ( cookiesPath ) ) {
340366 const stats = fs . statSync ( cookiesPath ) ;
341- console . log ( '[ELECTRON BROWSER] Cookies file size after flush:' , stats . size , 'bytes' ) ;
367+ console . log (
368+ '[ELECTRON BROWSER] Cookies file size after flush:' ,
369+ stats . size ,
370+ 'bytes'
371+ ) ;
342372 } else {
343- console . log ( '[ELECTRON BROWSER] WARNING: Cookies file does not exist after flush!' ) ;
373+ console . log (
374+ '[ELECTRON BROWSER] WARNING: Cookies file does not exist after flush!'
375+ ) ;
344376 }
345377 } catch ( error ) {
346378 console . error ( '[ELECTRON BROWSER] Failed to flush storage data:' , error ) ;
@@ -368,9 +400,14 @@ app.on('before-quit', async (event) => {
368400
369401 // Log cookies before flush
370402 const cookiesBeforeQuit = await userLoginSession . cookies . get ( { } ) ;
371- console . log ( '[ELECTRON BROWSER] Cookies count before quit:' , cookiesBeforeQuit . length ) ;
403+ console . log (
404+ '[ELECTRON BROWSER] Cookies count before quit:' ,
405+ cookiesBeforeQuit . length
406+ ) ;
372407 if ( cookiesBeforeQuit . length > 0 ) {
373- console . log ( '[ELECTRON BROWSER] Cookie domains before quit:' , [ ...new Set ( cookiesBeforeQuit . map ( c => c . domain ) ) ] ) ;
408+ console . log ( '[ELECTRON BROWSER] Cookie domains before quit:' , [
409+ ...new Set ( cookiesBeforeQuit . map ( ( c ) => c . domain ) ) ,
410+ ] ) ;
374411 }
375412
376413 // Flush storage
0 commit comments