@@ -211,17 +211,21 @@ export const resizePage = defineTool({
211211 handler : async ( request , response , context ) => {
212212 const page = context . getSelectedPage ( ) ;
213213
214- const browser = page . browser ( ) ;
215- const windowId = await page . windowId ( ) ;
214+ try {
215+ const browser = page . browser ( ) ;
216+ const windowId = await page . windowId ( ) ;
216217
217- const bounds = await browser . getWindowBounds ( windowId ) ;
218+ const bounds = await browser . getWindowBounds ( windowId ) ;
218219
219- if ( bounds . windowState === 'fullscreen' ) {
220- // have to call this twice when window is in fullscreen mode
221- await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
222- await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
223- } else if ( bounds . windowState !== 'normal' ) {
224- await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
220+ if ( bounds . windowState === 'fullscreen' ) {
221+ // have to call this twice when window is in fullscreen mode
222+ await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
223+ await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
224+ } else if ( bounds . windowState !== 'normal' ) {
225+ await browser . setWindowBounds ( windowId , { windowState : 'normal' } ) ;
226+ }
227+ } catch {
228+ // Window APIs are not supported on all platforms
225229 }
226230 await page . resize ( {
227231 contentWidth : request . params . width ,
0 commit comments