@@ -2367,6 +2367,8 @@ class WorkerTransport {
23672367
23682368 #pagePromises = new Map ( ) ;
23692369
2370+ #passwordCapability = null ;
2371+
23702372 constructor ( messageHandler , loadingTask , networkStream , params , factory ) {
23712373 this . messageHandler = messageHandler ;
23722374 this . loadingTask = loadingTask ;
@@ -2384,7 +2386,6 @@ class WorkerTransport {
23842386
23852387 this . destroyed = false ;
23862388 this . destroyCapability = null ;
2387- this . _passwordCapability = null ;
23882389
23892390 this . _networkStream = networkStream ;
23902391 this . _fullReader = null ;
@@ -2495,11 +2496,9 @@ class WorkerTransport {
24952496 this . destroyed = true ;
24962497 this . destroyCapability = new PromiseCapability ( ) ;
24972498
2498- if ( this . _passwordCapability ) {
2499- this . _passwordCapability . reject (
2500- new Error ( "Worker was destroyed during onPassword callback" )
2501- ) ;
2502- }
2499+ this . #passwordCapability?. reject (
2500+ new Error ( "Worker was destroyed during onPassword callback" )
2501+ ) ;
25032502
25042503 const waitOn = [ ] ;
25052504 // We need to wait for all renderings to be completed, e.g.
@@ -2702,27 +2701,27 @@ class WorkerTransport {
27022701 } ) ;
27032702
27042703 messageHandler . on ( "PasswordRequest" , exception => {
2705- this . _passwordCapability = new PromiseCapability ( ) ;
2704+ this . #passwordCapability = new PromiseCapability ( ) ;
27062705
27072706 if ( loadingTask . onPassword ) {
27082707 const updatePassword = password => {
27092708 if ( password instanceof Error ) {
2710- this . _passwordCapability . reject ( password ) ;
2709+ this . #passwordCapability . reject ( password ) ;
27112710 } else {
2712- this . _passwordCapability . resolve ( { password } ) ;
2711+ this . #passwordCapability . resolve ( { password } ) ;
27132712 }
27142713 } ;
27152714 try {
27162715 loadingTask . onPassword ( updatePassword , exception . code ) ;
27172716 } catch ( ex ) {
2718- this . _passwordCapability . reject ( ex ) ;
2717+ this . #passwordCapability . reject ( ex ) ;
27192718 }
27202719 } else {
2721- this . _passwordCapability . reject (
2720+ this . #passwordCapability . reject (
27222721 new PasswordException ( exception . message , exception . code )
27232722 ) ;
27242723 }
2725- return this . _passwordCapability . promise ;
2724+ return this . #passwordCapability . promise ;
27262725 } ) ;
27272726
27282727 messageHandler . on ( "DataLoaded" , data => {
0 commit comments