Skip to content
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

docs: distinction between setPermissionRequestHandler and setPermissionCheckHandler is unclear #19405

Closed
3 tasks done
bughit opened this issue Jul 23, 2019 · 4 comments
Closed
3 tasks done

Comments

@bughit
Copy link
Contributor

bughit commented Jul 23, 2019

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

https://electronjs.org/docs/api/session#sessetpermissioncheckhandlerhandler

From the documented minor differences, it's not clear why both are needed and when one should use which.

@MarshallOfSound I found that you added setPermissionCheckHandler in #13925, could you please clarify?

@MarshallOfSound
Copy link
Member

@bughit setPermissionRequestHandler handles permissions requests that can be responded to asynchronously (hence the callback). setPermissionCheckHandler handles permission checks that must be responded to synchronously.

@bughit
Copy link
Contributor Author

bughit commented Jul 24, 2019

I was logging both, just to understand them better in a page that wants audio and video and I was seeing media audio requests on both, PermissionRequestHandler and PermissionCheckHandler. Evidently requests for same perm type can be both sync and async. So if it's not the perm type, what differentiates async and sync requests?

@MarshallOfSound
Copy link
Member

@bughit It's where it comes from in Chromium. E.g. When a page calls xxx.requestPermission() it will fire a permission request. If they then do xxx.doTheThing() it may fire a synchronous permission check to validate.

@pushkin-
Copy link

@MarshallOfSound just to double check, would you then recommend using both methods for added security? this page and this page only call out setPermissionRequestHandler. Or is having both redundant?

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

No branches or pull requests

3 participants