Skip to content

[BUG] Firefox browser.close throws Protocol error (Browser.removeBrowserContext): Browser closed #6020

@mxschmitt

Description

@mxschmitt

Context:

Code Snippet

Minimal reproducible:

const playwright = require("playwright");

// 1. Install code-server `npm install code-server` and run locally: `npx code-server`
// 2. node test.js

(async () => {
  const browserServer = await playwright.firefox.launchServer()
  const browser = await playwright.firefox.connect({
    wsEndpoint: browserServer.wsEndpoint()
  })
  const context = await browser.newContext();
  const page = await context.newPage()

  await page.goto("http://localhost:8080")
  const title = await page.title()
  console.log({ title })
  try {
    await browser.close()
  } catch(err) {
    console.log("yes here: ↓")
    console.log(err)
  }
  await browserServer.close()
})()

This throws at the browser.close() statement around 5 of 10 times the following:

browser.close: Protocol error (Browser.removeBrowserContext): Browser closed.
==================== Browser output: ====================
<launching> /Users/temporaryadmin/Library/Caches/ms-playwright/firefox-1238/firefox/Nightly.app/Contents/MacOS/firefox -no-remote -headless -profile /var/folders/q8/c1b5lsw56474bw7wrmy0wqw80000gp/T/playwright_firefoxdev_profile-sSHRZ9 -juggler-pipe -silent
<launched> pid=50412
[pid=50412][err] *** You are running in headless mode.
[pid=50412][out] 
[pid=50412][out] Juggler listening to the pipe
[pid=50412][out] console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)"))
[pid=50412][out] Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: Receive IPC close with reason=AbnormalShutdown (t=0.808932) [GFX1-]: Receive IPC close with reason=AbnormalShutdown
[pid=50412][err] Exiting due to channel error.
[pid=50412][out] Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: Receive IPC close with reason=AbnormalShutdown (t=1.14308) [GFX1-]: Receive IPC close with reason=AbnormalShutdown
[pid=50412][err] Exiting due to channel error.
Error
    at Object.captureStackTrace (/Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/utils/stackTrace.js:48:19)
    at Connection.sendMessageToServer (/Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/client/connection.js:69:48)
    at Proxy.<anonymous> (/Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/client/channelOwner.js:64:61)
    at /Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/client/browser.js:69:31
    at FirefoxBrowser._wrapApiCall (/Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/client/channelOwner.js:77:34)
    at FirefoxBrowser.close (/Users/temporaryadmin/development/jest-playwright-repro/node_modules/playwright/lib/client/browser.js:68:24)
    at /Users/temporaryadmin/development/jest-playwright-repro/test.js:18:19

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions