Skip to content

Commit

Permalink
docs: note that permissions list may change (#33690)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Nov 20, 2024
1 parent 1afb56e commit 94776ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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.
:::

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

0 comments on commit 94776ad

Please sign in to comment.