Skip to content

Commit 9879da8

Browse files
mickey-mikeyclaude
andcommitted
fix(mcp): handle downloads gracefully in extension mode
In extension mode, Browser.setDownloadBehavior is no-oped in the CDP relay because it's a browser-level command that can't be forwarded through the tab-level chrome.debugger session. This means download events never fire, causing navigate() to throw "Download is starting" even though Chrome downloads the file successfully. Return gracefully when in extension mode instead of re-throwing. Fixes #39253 Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent c4a698f commit 9879da8

File tree

1 file changed

+4
-1
lines changed
  • packages/playwright/src/mcp/browser

1 file changed

+4
-1
lines changed

packages/playwright/src/mcp/browser/tab.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,11 @@ export class Tab extends EventEmitter<TabEventsInterface> {
297297
throw e;
298298
// on chromium, the download event is fired *after* page.goto rejects, so we wait a lil bit
299299
const download = await downloadEvent;
300-
if (!download)
300+
if (!download) {
301+
if (this.context.config.extension)
302+
return;
301303
throw e;
304+
}
302305
// Make sure other "download" listeners are notified first.
303306
await new Promise(resolve => setTimeout(resolve, 500));
304307
return;

0 commit comments

Comments
 (0)