@@ -336,9 +336,6 @@ suite('Trap detection', () => {
336336 }
337337 } ) ;
338338
339- // 1. Return 0 and complete post-return normally; verify the result and another export.
340- // 2. Return 1 successfully from Rust, then trap in post-return; verify the caller gets the trap.
341- // 3. Call the other export again; verify the trapped component refuses further entry.
342339 test . concurrent ( 'post-return trap prevents subsequent synchronous calls' , testSynchronousPostReturnTrap ) ;
343340
344341 describe . skipIf ( typeof WebAssembly . Suspending !== 'function' ) ( 'post-return traps with JSPI' , ( ) => {
@@ -366,18 +363,15 @@ suite('Trap detection', () => {
366363 const subsequentResult = instance . ok ( ) ;
367364 assert . strictEqual ( subsequentResult , 42 ) ;
368365
369- // The core export succeeds; its post-return failure must reach the caller.
370366 assert . throws ( ( ) => instance . returnWithCleanup ( 1 ) , WebAssembly . RuntimeError , / u n r e a c h a b l e / ) ;
371367
372- // The trapped instance must reject entry into an independent export.
373368 assert . throws ( ( ) => instance . ok ( ) , WebAssembly . RuntimeError , 'wasm trap: cannot enter component instance' ) ;
374369 } finally {
375370 await cleanupFixture ( ) ;
376371 }
377372 }
378373
379374 async function testJspiPostReturnTrap ( ) {
380- // Expose a synchronous WIT operation through a JSPI Promise wrapper.
381375 const { instance, cleanup : cleanupFixture } = await setupAsyncTest ( {
382376 asyncMode : 'jspi' ,
383377 component : {
@@ -398,20 +392,17 @@ suite('Trap detection', () => {
398392 const subsequentResult = instance . ok ( ) ;
399393 assert . strictEqual ( subsequentResult , 42 ) ;
400394
401- // The core export succeeds; its post-return failure must reach the caller.
402395 const failingCall = instance . returnWithCleanup ( 1 ) ;
403396 await expect ( failingCall ) . rejects . toBeInstanceOf ( WebAssembly . RuntimeError ) ;
404397 await expect ( failingCall ) . rejects . toThrow ( / u n r e a c h a b l e / ) ;
405398
406- // The trapped instance must reject entry into an independent export.
407399 assert . throws ( ( ) => instance . ok ( ) , WebAssembly . RuntimeError , 'wasm trap: cannot enter component instance' ) ;
408400 } finally {
409401 await cleanupFixture ( ) ;
410402 }
411403 }
412404
413405 async function testWitAsyncPostReturnTrap ( ) {
414- // Exercise an operation declared asynchronous in WIT, using JSPI.
415406 const { instance, cleanup : cleanupFixture } = await setupAsyncTest ( {
416407 asyncMode : 'jspi' ,
417408 component : {
@@ -427,13 +418,10 @@ suite('Trap detection', () => {
427418 const subsequentResult = instance . ok ( ) ;
428419 assert . strictEqual ( subsequentResult , 42 ) ;
429420
430- // Post-return traps after the task has recorded the successful core result.
431- // The caller must receive the trap instead of that recorded result.
432421 const failingCall = instance . returnWithCleanup ( 1 ) ;
433422 await expect ( failingCall ) . rejects . toBeInstanceOf ( WebAssembly . RuntimeError ) ;
434423 await expect ( failingCall ) . rejects . toThrow ( / u n r e a c h a b l e / ) ;
435424
436- // The trapped instance must reject entry into an independent export.
437425 assert . throws ( ( ) => instance . ok ( ) , WebAssembly . RuntimeError , 'wasm trap: cannot enter component instance' ) ;
438426 } finally {
439427 await cleanupFixture ( ) ;
0 commit comments