@@ -5679,14 +5679,18 @@ def test_rollup(self):
56795679 shutil .copy ('hello.wasm' , 'dist/' )
56805680 self .run_browser ('index.html' , '/report_result?exit:0' )
56815681
5682- def test_cross_origin (self ):
5682+ @parameterized ({
5683+ '' : ([],),
5684+ 'es6' : (['-sEXPORT_ES6' , '--extern-post-js' , test_file ('modularize_post_js.js' )],),
5685+ })
5686+ def test_cross_origin (self , args ):
56835687 # Verfies that the emscripten-generted JS and Wasm can be hosted on a different origin.
56845688 # This test create a second HTTP server running on port 9999 that servers files from `subdir`.
56855689 # The main html is the servers from the normal 8888 server while the JS and Wasm are hosted
56865690 # on at 9999.
56875691 os .mkdir ('subdir' )
56885692 create_file ('subdir/foo.txt' , 'hello' )
5689- self .compile_btest ('hello_world.c' , ['-o' , 'subdir/hello.js' , '-sCROSS_ORIGIN' , '-sPROXY_TO_PTHREAD' , '-pthread' , '-sEXIT_RUNTIME' ])
5693+ self .compile_btest ('hello_world.c' , ['-o' , 'subdir/hello.js' , '-sRUNTIME_DEBUG' , '- sCROSS_ORIGIN' , '-sPROXY_TO_PTHREAD' , '-pthread' , '-sEXIT_RUNTIME' ] + args )
56905694
56915695 class MyReqestHandler (SimpleHTTPRequestHandler ):
56925696 def __init__ (self , * args , ** kwargs ):
@@ -5707,9 +5711,10 @@ def end_headers(self):
57075711
57085712 return SimpleHTTPRequestHandler .end_headers (self )
57095713
5710- create_file ('test.html' , '''
5711- <script src="http://localhost:9999/hello.js"></script>
5712- ''' )
5714+ if '-sEXPORT_ES6' in args :
5715+ create_file ('test.html' , '<script src="http://localhost:9999/hello.js" type="module"></script>' )
5716+ else :
5717+ create_file ('test.html' , '<script src="http://localhost:9999/hello.js"></script>' )
57135718
57145719 server = HttpServerThread (ThreadingHTTPServer (('localhost' , 9999 ), MyReqestHandler ))
57155720 server .start ()
0 commit comments