[docs]: add docs for `setDomainPolicy`

Merged
SE
4mo ago
+110-0

why

  • adds documentation for setDomainPolicy()

what changed

Screenshot 2026-07-13 at 11 07 35 AM

Summary by cubic

Adds docs for context.setDomainPolicy() and context.getDomainPolicy() to control HTTP(S) requests by domain across a context, with examples and error details. Addresses Linear STG-2426.

  • New Features
    • Documented setDomainPolicy(policy: DomainPolicy | null) and getDomainPolicy() with TypeScript signatures, behavior, scope (pages, iframes, subresources), and how to clear.
    • Clarified domain-only patterns: exact vs wildcard, subdomain rules (*.example.com doesn’t match example.com), case-insensitive matching, duplicate patterns ignored, and no schemes/paths/ports; blockedDomains overrides allowedDomains; non-HTTP(S) unaffected; blocked requests show Chrome “BlockedByClient”.
    • Added a “Domain Policy” example tab using @browserbasehq/stagehand, and updated API reference with new errors (StagehandInvalidArgumentError, StagehandSetDomainPolicyError) plus V3Context and DomainPolicy interface snippets.