@@ -5396,52 +5396,23 @@ def test_fetch_polyfill_preload(self):
53965396        buf[20] = 0; 
53975397        fclose(f); 
53985398        printf("|%%s|\n", buf); 
5399-         return 0 ; 
5399+         return 42 ; 
54005400      } 
54015401      '''  %  path )
5402-     create_file ('on_window_error_shell.html' , r''' 
5403-       <html> 
5404-           <center><canvas id='canvas' width='256' height='256'></canvas></center> 
5405-           <hr><div id='output'></div><hr> 
5406-           <script type='text/javascript'> 
5407-             window.addEventListener('error', event => { 
5408-               const error = String(event.message); 
5409-               console.log({error}); 
5410-               window.disableErrorReporting = true; 
5411-               window.onerror = null; 
5412-               var xhr = new XMLHttpRequest(); 
5413-               xhr.open('GET', 'http://localhost:8888/report_result?' + (error.includes('fetch is not a function') ? 1 : 0), true); 
5414-               xhr.send(); 
5415-               setTimeout(function() { window.close() }, 1000); 
5416-             }); 
5417-             var Module = { 
5418-               print: (function() { 
5419-                 var element = document.getElementById('output'); 
5420-                 return function(text) { 
5421-                   console.log({text}); 
5422-                   if(window.disableErrorReporting) return; 
5423-                   element.innerHTML += text.replace('\n', '<br>', 'g') + '<br>'; 
5424-                   var xhr = new XMLHttpRequest(); 
5425-                   xhr.open('GET', 'http://localhost:8888/report_result?' + (text === '|hello, world!|' ? 1 : 0), true); 
5426-                   xhr.send(); 
5427-                 }; 
5428-               })(), 
5429-               canvas: document.getElementById('canvas') 
5430-             }; 
5431-           </script> 
5432-           {{{ SCRIPT }}} 
5433-         </body> 
5434-       </html>''' )
54355402
54365403    def  test (args , expect_fail ):
5437-       self .compile_btest ('main.cpp' , args  +  ['--preload-file' , path , '--shell-file'  ,  'on_window_error_shell.html' ,  '- o''a.out.html' ])
5404+       self .compile_btest ('main.cpp' , args  +  ['--preload-file' , path , '-o' , 'a.out.html' ])
54385405      if  expect_fail :
54395406        js  =  read_file ('a.out.js' )
54405407        create_file ('a.out.js' , 'fetch = undefined;\n '  +  js )
5441-         return  self .run_browser ('a.out.html' , '/report_result?0 ' )
5408+         return  self .run_browser ('a.out.html' , '/report_result?exception:fetch is not a function ' )
54425409      else :
5443-         return  self .run_browser ('a.out.html' , '/report_result?1' )
5444- 
5410+         return  self .run_browser ('a.out.html' , '/report_result?42' )
5411+   
5412+     test ([], expect_fail = False )
5413+     test (['-sLEGACY_VM_SUPPORT' ], expect_fail = False )
5414+     test (['-sLEGACY_VM_SUPPORT' , '-sNO_POLYFILL' ], expect_fail = True )
5415+   
54455416  @no_wasm64 ('https://github.com/llvm/llvm-project/issues/98778' ) 
54465417  def  test_fetch_polyfill_shared_lib (self ):
54475418    create_file ('library.c' , r''' 
0 commit comments