Skip to content

bug(browse): BROWSE_EXTENSIONS_DIR causes visible Chromium window on macOS #432

@yinanli1917-cloud

Description

@yinanli1917-cloud

Bug

PR #315 added Chrome extension support via BROWSE_EXTENSIONS_DIR. Two issues found:

  1. Visible Chromium window on macOS. The --window-position=-9999,-9999 approach doesn't work — newPage() creates new windows that ignore startup position flags.

  2. Extensions don't actually run. browser.newContext() creates an isolated context. Extensions only execute in the default browser context, so content scripts, service workers, and declarativeNetRequest rules were all silently inactive.

Root cause

  • Playwright's chromium.launch() + browser.newContext() = isolated context = extensions invisible to pages
  • --window-position only affects the initial browser window, not windows created by newPage() via CDP Target.createTarget

Fix

Submitted a follow-up PR with:

  • launchPersistentContext() — extensions run in the default browser context
  • --headless=new — no visible window (Chromium 112+ supports extensions in new headless mode)
  • ignoreDefaultArgs to strip --disable-extensions and --enable-automation
  • Cookie persistence across daemon restarts (~/.gstack/browse-cookies.json)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions