garrytan / garrytan/gstack

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

Open
#432 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
133k
Forks
19.9k
Avg merge
18h 46m
Merged PRs (30d)
26

Description

## 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`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.