File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,13 @@ class Client extends EventEmitter {
9393 * Private function
9494 */
9595 async inject ( ) {
96+ let hasReloaded = false ;
97+ const reloadHandler = async ( ) => {
98+ hasReloaded = true ;
99+ } ;
100+ try {
101+ this . pupPage . on ( 'framenavigated' , reloadHandler ) ;
102+
96103 await this . pupPage . waitForFunction ( 'window.Debug?.VERSION != undefined' , { timeout : this . options . authTimeoutMs } ) ;
97104
98105 const version = await this . getWWebVersion ( ) ;
@@ -255,6 +262,13 @@ class Client extends EventEmitter {
255262 await window . onLogoutEvent ( ) ;
256263 } ) ;
257264 } ) ;
265+
266+ } catch ( err ) {
267+ if ( ! hasReloaded )
268+ throw err ;
269+ } finally {
270+ this . pupPage . off ( 'framenavigated' , reloadHandler ) ;
271+ }
258272 }
259273
260274 /**
You can’t perform that action at this time.
0 commit comments