Skip to content

Harden browser-context CDP routing by context identity and root health #50

Description

@kitlangton

Problem

PR #49 routes Playwright browser-context permission and cookie commands through a Browser Control-owned root, but routing still relies on ownership alone.

  • Explicit browserContextId parameters are forwarded without validating that they match the selected root. Chromium can reject storage commands sent through a page target for another context, while permission commands may affect the wrong context.
  • Multi-page named sessions choose the first owned root even when that target is crashed, so a healthy sibling cannot keep context APIs working.
  • Raw clients fail as ambiguous whenever more than one root is visible, even when all roots belong to one Chromium context.
  • Coverage sends synthetic CDP commands to a fake extension. It does not exercise Playwright context.cookies(), addCookies(), grantPermissions(), or clearPermissions() against Chromium.

Desired behavior

Route by validated Browser Control ownership, Chromium context identity, and target health. Prefer the durable healthy default root for named sessions, reject mismatched explicit context IDs, and continue failing closed when roots span unrelated contexts. Keep Storage.clearCookies blocked by guardrails.

Coverage

Add a mandatory real-browser smoke case that:

  • Adds, reads, and expires a uniquely named cookie through Playwright context APIs.
  • Grants, queries, and clears geolocation permission.
  • Repeats with a second session-owned page.
  • Covers an explicit mismatched context ID and a crashed-first/healthy-second root.
  • Verifies raw clients group roots by validated context identity without guessing across contexts.

Also decide whether Browser Control pins the supported Playwright version or tests the declared minimum and newest compatible release whenever root-routable methods change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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