@@ -5664,14 +5664,18 @@ def test_rollup(self):
56645664 shutil .copy ('hello.wasm' , 'dist/' )
56655665 self .run_browser ('index.html' , '/report_result?exit:0' )
56665666
5667- def test_cross_origin (self ):
5667+ @parameterized ({
5668+ '' : ([],),
5669+ 'es6' : (['-sEXPORT_ES6' , '--extern-post-js' , test_file ('modularize_post_js.js' )],),
5670+ })
5671+ def test_cross_origin (self , args ):
56685672 # Verfies that the emscripten-generted JS and Wasm can be hosted on a different origin.
56695673 # This test create a second HTTP server running on port 9999 that servers files from `subdir`.
56705674 # The main html is the servers from the normal 8888 server while the JS and Wasm are hosted
56715675 # on at 9999.
56725676 os .mkdir ('subdir' )
56735677 create_file ('subdir/foo.txt' , 'hello' )
5674- self .compile_btest ('hello_world.c' , ['-o' , 'subdir/hello.js' , '-sCROSS_ORIGIN' , '-sPROXY_TO_PTHREAD' , '-pthread' , '-sEXIT_RUNTIME' ])
5678+ self .compile_btest ('hello_world.c' , ['-o' , 'subdir/hello.js' , '-sRUNTIME_DEBUG' , '- sCROSS_ORIGIN' , '-sPROXY_TO_PTHREAD' , '-pthread' , '-sEXIT_RUNTIME' ] + args )
56755679
56765680 class MyReqestHandler (SimpleHTTPRequestHandler ):
56775681 def __init__ (self , * args , ** kwargs ):
@@ -5692,9 +5696,10 @@ def end_headers(self):
56925696
56935697 return SimpleHTTPRequestHandler .end_headers (self )
56945698
5695- create_file ('test.html' , '''
5696- <script src="http://localhost:9999/hello.js"></script>
5697- ''' )
5699+ if '-sEXPORT_ES6' in args :
5700+ create_file ('test.html' , '<script src="http://localhost:9999/hello.js" type="module"></script>' )
5701+ else :
5702+ create_file ('test.html' , '<script src="http://localhost:9999/hello.js"></script>' )
56985703
56995704 server = HttpServerThread (ThreadingHTTPServer (('localhost' , 9999 ), MyReqestHandler ))
57005705 server .start ()
0 commit comments