(session: NativeExportSession, plugin: CodeSpacePlugin)
| 358 | } |
| 359 | |
| 360 | function installPopupWindowHook(session: NativeExportSession, plugin: CodeSpacePlugin) { |
| 361 | const win = session.ownerWindow; |
| 362 | const originalOpen = win.open.bind(win); |
| 363 | |
| 364 | win.open = ((...args: Parameters<typeof window.open>) => { |
| 365 | debugNativePdf(session, "window.open intercepted", { |
| 366 | url: args[0] ?? "", |
| 367 | target: args[1] ?? "", |
| 368 | features: args[2] ?? "", |
| 369 | }); |
| 370 | const popupWindow = originalOpen(...args); |
| 371 | if (activeNativeExportSession === session && popupWindow) { |
| 372 | session.popupOpened = true; |
| 373 | debugNativePdf(session, "popup window opened successfully"); |
| 374 | installPopupPrintObserver(session, plugin, popupWindow); |
| 375 | } |
| 376 | return popupWindow; |
| 377 | }) as typeof window.open; |
| 378 | |
| 379 | session.restoreWindowOpen = () => { |
| 380 | win.open = originalOpen as typeof window.open; |
| 381 | }; |
| 382 | } |
| 383 | |
| 384 | function beginNativeExportSession( |
| 385 | plugin: CodeSpacePlugin, |
no test coverage detected