@@ -617,7 +617,7 @@ def test_preload_caching(self, extra_size):
617617
618618 def test_preload_caching_indexeddb_name (self ):
619619 self .set_setting ('EXIT_RUNTIME' )
620- create_file ('somefile.txt' , ''' load me right before running the code please'' ' )
620+ create_file ('somefile.txt' , 'load me right before running the code please' )
621621
622622 def make_main (path ):
623623 print (path )
@@ -640,20 +640,21 @@ def make_main(path):
640640 int result = 0;
641641
642642 assert(strcmp("load me right before", buf) == 0);
643- return checkPreloadResults();
643+ int num_cached = checkPreloadResults();
644+ printf("got %%d preloadResults from cache\n", num_cached);
645+ return num_cached;
644646 }
645647 ''' % path )
646648
647649 create_file ('test.js' , '''
648650 addToLibrary({
649- checkPreloadResults: function() {
651+ checkPreloadResults: () => {
650652 var cached = 0;
651- var packages = Object.keys(Module['preloadResults']);
652- packages.forEach(function(package) {
653- var fromCache = Module['preloadResults'][package]['fromCache'];
654- if (fromCache)
655- ++ cached;
656- });
653+ for (var result of Object.values(Module['preloadResults'])) {
654+ if (result['fromCache']) {
655+ cached++;
656+ }
657+ }
657658 return cached;
658659 }
659660 });
@@ -663,6 +664,7 @@ def make_main(path):
663664 self .run_process ([FILE_PACKAGER , 'somefile.data' , '--use-preload-cache' , '--indexedDB-name=testdb' , '--preload' , 'somefile.txt' , '--js-output=' + 'somefile.js' ])
664665 self .compile_btest ('main.c' , ['--js-library' , 'test.js' , '--pre-js' , 'somefile.js' , '-o' , 'page.html' , '-sFORCE_FILESYSTEM' ], reporting = Reporting .JS_ONLY )
665666 self .run_browser ('page.html' , '/report_result?exit:0' )
667+ print ("Re-running .." )
666668 self .run_browser ('page.html' , '/report_result?exit:1' )
667669
668670 def test_multifile (self ):
0 commit comments