File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,9 +186,13 @@ export const newPage = defineTool(args => {
186186 ...timeoutSchema ,
187187 } ,
188188 handler : async ( request , response , context ) => {
189+ const isolatedContext =
190+ request . params . isolatedContext === ''
191+ ? undefined
192+ : request . params . isolatedContext ;
189193 const page = await context . newPage (
190194 request . params . background ,
191- request . params . isolatedContext ,
195+ isolatedContext ,
192196 ) ;
193197
194198 await navigateWithInterception (
Original file line number Diff line number Diff line change @@ -363,6 +363,20 @@ describe('pages', () => {
363363 } ) ;
364364 } ) ;
365365
366+ it ( 'treats an empty isolatedContext as the default context' , async ( ) => {
367+ await withMcpContext ( async ( response , context ) => {
368+ const defaultContext = context . getSelectedPptrPage ( ) . browserContext ( ) ;
369+ await newPage ( ) . handler (
370+ { params : { url : 'about:blank' , isolatedContext : '' } } ,
371+ response ,
372+ context ,
373+ ) ;
374+ const page = context . getSelectedPptrPage ( ) ;
375+ assert . strictEqual ( context . getIsolatedContextName ( page ) , undefined ) ;
376+ assert . strictEqual ( page . browserContext ( ) , defaultContext ) ;
377+ } ) ;
378+ } ) ;
379+
366380 it ( 'closes an isolated page without errors' , async ( ) => {
367381 await withMcpContext ( async ( response , context ) => {
368382 await newPage ( ) . handler (
You can’t perform that action at this time.
0 commit comments