@@ -392,6 +392,29 @@ it('NE-051 should return body for image with evicted body', {
392392 expect ( body . toString ( 'base64' ) ) . toBe ( imageBase64 ) ;
393393} ) ;
394394
395+ it ( 'NE-145 should return source for a module script loaded from cache' , {
396+ annotation : { type : 'issue' , description : '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/microsoft/playwright/issues/43991' } ,
397+ } , async ( { page, server } ) => {
398+ const source = Array . from ( { length : 400 } , ( _ , i ) => `export function f${ i } () { return ${ i } ; }` ) . join ( '\n' ) ;
399+ server . setRoute ( '/module.js' , ( req , res ) => {
400+ res . writeHead ( 200 , { 'Content-Type' : 'text/javascript' , 'Cache-Control' : 'max-age=3600' } ) ;
401+ res . end ( source ) ;
402+ } ) ;
403+ server . setRoute ( '/module.html' , ( req , res ) => {
404+ res . setHeader ( 'Content-Type' , 'text/html' ) ;
405+ res . end ( '<script type="module" src="/module.js"></script>' ) ;
406+ } ) ;
407+ // Firefox stores module bytecode in the HTTP cache after several loads.
408+ for ( let i = 0 ; i < 5 ; ++ i ) {
409+ const [ response ] = await Promise . all ( [
410+ page . waitForResponse ( '**/module.js' ) ,
411+ page . goto ( server . PREFIX + '/module.html' ) ,
412+ ] ) ;
413+ expect ( ( await response . body ( ) ) . toString ( ) ) . toBe ( source ) ;
414+ await page . waitForTimeout ( 500 ) ;
415+ }
416+ } ) ;
417+
395418it ( 'NE-052 should bypass disk cache when page interception is enabled' , async ( { page, server } ) => {
396419 it . info ( ) . annotations . push ( { type : 'issue' , description : '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/microsoft/playwright/issues/30000' } ) ;
397420 await page . goto ( server . PREFIX + '/frames/one-frame.html' ) ;
0 commit comments