New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: route frame based permission checks through our permission check handler #14569
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,17 +315,21 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents | |
|
||
* `handler` Function<Boolean> | null | ||
* `webContents` [WebContents](web-contents.md) - WebContents checking the permission. | ||
* `permission` String - Enum of 'media'. | ||
* `permission` String - Enum of 'media', 'midiSysex', 'notifications', 'geolocation', 'mediaKeySystem' or 'midi'. | ||
* `requestingOrigin` String - The origin URL of the permission check | ||
* `details` Object - Some properties are only available on certain permission types. | ||
* `securityOrigin` String - The security orign of the `media` check. | ||
* `mediaType` String - The type of media access being requested, can be `video`, | ||
`audio` or `unknown` | ||
`audio` or `unknown`. This property is only set on `media` checks. | ||
|
||
Sets the handler which can be used to respond to permission checks for the `session`. | ||
Returning `true` will allow the permission and `false` will reject it. | ||
To clear the handler, call `setPermissionCheckHandler(null)`. | ||
|
||
Please note not all syncronous permission checks are passed through this handler, | ||
for instance `Notification.granted` is not routed but `new Notification` will cause | ||
the `permissionRequestHandler` to be fired. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is confusing. Is returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nornagon In some cases returning false here will block usage of the feature, in other cases you'll have to return false here and block it in the request handler as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a developer, that's totally useless information to me unless the docs specifically describe what this will prevent. I understand if the intention is that ultimately, returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nornagon I'm not sure how to phrase this but basically there are 3 types of checks coming through / not coming through this handler now
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That functionality comes from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By using "for instance" in docs here, it is not clear which checks will come through the handler and which will not. I think we should list all checks that will not come through the handler, and mark that type of check as experimental. |
||
|
||
```javascript | ||
const {session} = require('electron') | ||
session.fromPartition('some-partition').setPermissionCheckHandler((webContents, permission) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
Abbreviations are evil.