Skip to content

Add BrowserContext.SetPermissionAsync API (#3112)#3153

Merged
kblok merged 4 commits intomasterfrom
implement-upstream-change-3112
Feb 19, 2026
Merged

Add BrowserContext.SetPermissionAsync API (#3112)#3153
kblok merged 4 commits intomasterfrom
implement-upstream-change-3112

Conversation

@kblok
Copy link
Member

@kblok kblok commented Feb 18, 2026

Summary

  • Adds SetPermissionAsync method to IBrowserContext and IBrowser for fine-grained permission control
  • Supports setting individual permissions to granted, denied, or prompt states via PermissionDescriptor and PermissionEntry classes
  • Implements CDP support (including * wildcard origin) and BiDi support (with appropriate unsupported feature checks)
  • Marks existing OverridePermissionsAsync as deprecated in favor of the new API

Test plan

  • New tests pass on Chrome/CDP (3 tests: set permission, wildcard origin, multiple permissions)
  • New tests pass on Firefox/BiDi (2 pass, 1 correctly skipped for * origin)
  • Existing OverridePermissionsAsync tests still pass

Closes #3112

🤖 Generated with Claude Code

kblok and others added 4 commits February 18, 2026 09:52
Implements the upstream setPermission API that provides fine-grained
control over browser permissions. Unlike OverridePermissionsAsync
(now deprecated), this allows setting individual permissions to
specific states (granted, denied, prompt) without affecting others.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CI format check treats CS0618 warnings as errors, and existing
tests still call OverridePermissionsAsync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add LocalFonts to OverridePermission enum and add the corresponding
case in BidiBrowserContext.GetPermissionName() to prevent
ArgumentOutOfRangeException when iterating all permissions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kblok kblok merged commit ac192c1 into master Feb 19, 2026
21 of 22 checks passed
@kblok kblok deleted the implement-upstream-change-3112 branch February 19, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add BrowserContext.setPermission API

1 participant