@@ -617,7 +617,7 @@ def test_preload_caching(self, extra_size):
617
617
618
618
def test_preload_caching_indexeddb_name (self ):
619
619
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' )
621
621
622
622
def make_main (path ):
623
623
print (path )
@@ -640,20 +640,21 @@ def make_main(path):
640
640
int result = 0;
641
641
642
642
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;
644
646
}
645
647
''' % path )
646
648
647
649
create_file ('test.js' , '''
648
650
addToLibrary({
649
- checkPreloadResults: function() {
651
+ checkPreloadResults: () => {
650
652
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
+ }
657
658
return cached;
658
659
}
659
660
});
@@ -663,6 +664,7 @@ def make_main(path):
663
664
self .run_process ([FILE_PACKAGER , 'somefile.data' , '--use-preload-cache' , '--indexedDB-name=testdb' , '--preload' , 'somefile.txt' , '--js-output=' + 'somefile.js' ])
664
665
self .compile_btest ('main.c' , ['--js-library' , 'test.js' , '--pre-js' , 'somefile.js' , '-o' , 'page.html' , '-sFORCE_FILESYSTEM' ], reporting = Reporting .JS_ONLY )
665
666
self .run_browser ('page.html' , '/report_result?exit:0' )
667
+ print ("Re-running .." )
666
668
self .run_browser ('page.html' , '/report_result?exit:1' )
667
669
668
670
def test_multifile (self ):
0 commit comments