Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs: note that permissions list may change #33690

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/src/api/class-browsercontext.md
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,14 @@ specified.
* since: v1.8
- `permissions` <[Array]<[string]>>

A permission or an array of permissions to grant. Permissions can be one of the following values:
A list of permissions to grant.

:::danger
Supported permissions differ between browsers, and even between different versions of the same browser. Any permission may stop working after an update.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last time I tried to give them a workaround with newCDPSession in order to grant custom permissions - for some reason it didn't work for me. Maybe it would make sense to give it to them aka. put it into the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we are interested in this usecase, but if someone files an issue about it, feel free to respond.

:::

Here are some permissions that may be supported by some browsers:
* `'accelerometer'`
* `'accessibility-events'`
* `'ambient-light-sensor'`
* `'background-sync'`
* `'camera'`
Expand Down
1 change: 0 additions & 1 deletion packages/playwright-core/src/server/chromium/crBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ export class CRBrowserContext extends BrowserContext {
['accelerometer', 'sensors'],
['gyroscope', 'sensors'],
['magnetometer', 'sensors'],
['accessibility-events', 'accessibilityEvents'],
['clipboard-read', 'clipboardReadWrite'],
['clipboard-write', 'clipboardSanitizedWrite'],
['payment-handler', 'paymentHandler'],
Expand Down
8 changes: 6 additions & 2 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8961,9 +8961,13 @@ export interface BrowserContext {
/**
* Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
* specified.
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
* @param permissions A list of permissions to grant.
*
* **NOTE** Supported permissions differ between browsers, and even between different versions of the same browser.
* Any permission may stop working after an update.
*
* Here are some permissions that may be supported by some browsers:
* - `'accelerometer'`
* - `'accessibility-events'`
* - `'ambient-light-sensor'`
* - `'background-sync'`
* - `'camera'`
Expand Down