@@ -1089,7 +1089,7 @@ class Benchmark {
10891089 scripts . add ( text ) ;
10901090 } else {
10911091 const cache = browserFileLoader . blobDataCache ;
1092- for ( const file of this . plan . files ) {
1092+ for ( const file of this . files ) {
10931093 scripts . addWithURL ( cache [ file ] . blobURL ) ;
10941094 }
10951095 }
@@ -1150,29 +1150,27 @@ class Benchmark {
11501150 prefetchResourcesForBrowser ( counter ) {
11511151 console . assert ( isInBrowser ) ;
11521152
1153- const promises = this . plan . files . map ( ( file ) => browserFileLoader . loadBlob ( "file" , null , file ) . then ( ( blobData ) => {
1153+ const promises = this . files . map ( ( file ) => browserFileLoader . loadBlob ( "file" , null , file ) . then ( ( blobData ) => {
11541154 if ( ! globalThis . allIsGood )
11551155 return ;
11561156 this . updateCounter ( ) ;
11571157 } ) . catch ( ( error ) => {
11581158 // We'll try again later in retryPrefetchResourceForBrowser(). Don't throw an error.
11591159 } ) ) ;
11601160
1161- if ( this . plan . preload ) {
1162- for ( const [ name , resource ] of Object . entries ( this . plan . preload ) ) {
1163- promises . push ( browserFileLoader . loadBlob ( "preload" , name , resource ) . then ( ( blobData ) => {
1164- if ( ! globalThis . allIsGood )
1165- return ;
1166- this . preloads . push ( { name : blobData . prop , resource : blobData . resource , blobURLOrPath : blobData . blobURL } ) ;
1167- this . updateCounter ( ) ;
1168- } ) . catch ( ( error ) => {
1169- // We'll try again later in retryPrefetchResourceForBrowser(). Don't throw an error.
1170- if ( ! this . failedPreloads )
1171- this . failedPreloads = { } ;
1172- this . failedPreloads [ name ] = true ;
1173- counter . failedPreloadResources ++ ;
1174- } ) ) ;
1175- }
1161+ for ( const [ name , resource ] of this . preloadEntries ) {
1162+ promises . push ( browserFileLoader . loadBlob ( "preload" , name , resource ) . then ( ( blobData ) => {
1163+ if ( ! globalThis . allIsGood )
1164+ return ;
1165+ this . preloads . push ( { name : blobData . prop , resource : blobData . resource , blobURLOrPath : blobData . blobURL } ) ;
1166+ this . updateCounter ( ) ;
1167+ } ) . catch ( ( error ) => {
1168+ // We'll try again later in retryPrefetchResourceForBrowser(). Don't throw an error.
1169+ if ( ! this . failedPreloads )
1170+ this . failedPreloads = { } ;
1171+ this . failedPreloads [ name ] = true ;
1172+ counter . failedPreloadResources ++ ;
1173+ } ) ) ;
11761174 }
11771175
11781176 JetStream . counter . totalResources += promises . length ;
@@ -1183,19 +1181,17 @@ class Benchmark {
11831181 // FIXME: Move to BrowserFileLoader.
11841182 console . assert ( isInBrowser ) ;
11851183
1186- for ( const resource of this . plan . files ) {
1184+ for ( const resource of this . files ) {
11871185 const allDone = await browserFileLoader . retryPrefetchResource ( "file" , null , resource ) ;
11881186
11891187 if ( allDone )
11901188 return true ; // All resources loaded, nothing more to do.
11911189 }
11921190
1193- if ( this . plan . preload ) {
1194- for ( const [ name , resource ] of Object . entries ( this . plan . preload ) ) {
1195- const allDone = await browserFileLoader . retryPrefetchResource ( "preload" , name , resource ) ;
1196- if ( allDone )
1197- return true ; // All resources loaded, nothing more to do.
1198- }
1191+ for ( const [ name , resource ] of this . preloadEntries ) {
1192+ const allDone = await browserFileLoader . retryPrefetchResource ( "preload" , name , resource ) ;
1193+ if ( allDone )
1194+ return true ; // All resources loaded, nothing more to do.
11991195 }
12001196 return ! counter . failedPreloadResources && counter . loadedResources == counter . totalResources ;
12011197 }
0 commit comments