feat: add --disable-geolocation command-line flag for macOS#45934
feat: add --disable-geolocation command-line flag for macOS#45934jkleinsc merged 14 commits intoelectron:mainfrom
Conversation
|
@deepak1556 Is this platform specific command-line flag fine or does it have to be extended to other platforms? |
|
Hi @codebytere, could I get a review on this? |
deepak1556
left a comment
There was a problem hiding this comment.
The PR is still set to draft hence reviews aren't appearing. Can you set it to ready so that wg-api can chime in.
docs/api/command-line-switches.md
Outdated
|
|
||
| ### --disable-geolocation-mac | ||
|
|
||
| Disables the Geolocation API on macOS. Has no effect on other platforms. |
There was a problem hiding this comment.
If an application sets this flag and accidentally calls navigator.geolocation api would that lead to a crash ?
If this flag is set should we deny permission for geolocation via https://github.com/electron/electron/blob/main/docs/api/session.md#sessetpermissionrequesthandlerhandler internally so that calls are canceled before they reach the device service ?
There was a problem hiding this comment.
@deepak1556 the app doesn't crash on my mac despite setting this flag and calling navigator.geolocation. But this could be due to the api not working correctly on Mac and as a result calls never reaching device service. Some concerns about this have been raised in the past Issue#45290
I’ve added some changes to deny permission for geolocation via https://github.com/electron/electron/blob/main/docs/api/session.md#sessetpermissionrequesthandlerhandler internally so that calls are canceled before they reach the device service. I need a review on this. Thanks.
There was a problem hiding this comment.
Can we document how this impacts the permission request API?
There was a problem hiding this comment.
Disables the Geolocation API. Permission requests for geolocation will be denied internally regardless of the decision made by a handler set via session.setPermissionRequestHandler. This functionality is currently implemented only for macOS. Has no effect on other platforms.
Is this okay?
There was a problem hiding this comment.
That sounds great. Thanks!
docs/api/command-line-switches.md
Outdated
|
|
||
| Disable HTTP/2 and SPDY/3.1 protocols. | ||
|
|
||
| ### --disable-geolocation-mac |
There was a problem hiding this comment.
This can be a generic flag --disable-geolocation and document it only for __macOS__ now which can be extended to other platforms if system services are integrated. I see wip in upstream for something similar on windows.
docs/api/command-line-switches.md
Outdated
|
|
||
| ### --disable-geolocation-mac | ||
|
|
||
| Disables the Geolocation API on macOS. Has no effect on other platforms. |
There was a problem hiding this comment.
Can we document how this impacts the permission request API?
itsananderson
left a comment
There was a problem hiding this comment.
Sorry for my slow response 😅
docs/api/command-line-switches.md
Outdated
|
|
||
| ### --disable-geolocation-mac | ||
|
|
||
| Disables the Geolocation API on macOS. Has no effect on other platforms. |
There was a problem hiding this comment.
That sounds great. Thanks!
No rush at all. You can check out the latest changes at your earliest convenience. Thanks! |
itsananderson
left a comment
There was a problem hiding this comment.
Left a small suggestion but otherwise API LGTM
b5ee90c to
f805af0
Compare
|
Hey @itsananderson I've added some tests and rebased. Lmk if there's anything else that needs to be done in order to land this pr. Thanks! |
deepak1556
left a comment
There was a problem hiding this comment.
LGTM, a couple more minor style changes and should be good to land. Thanks!
…ager as a static member
Co-authored-by: Robo <hop2deep@gmail.com>
e01ec30 to
6730da4
Compare
|
@itsananderson can we restart the CI checks pls |
|
The test builds seem like they might be having actual failures: That said, I don't know why this PR would be causing those tests to fail. Maybe they're just flaky? |
These tests actually passed in previous runs. Maybe restarting them once more might work? |
FTBFS on macOSThis PR has been around for quite awhile though. Do we want to land it? If so, then we should update and land it 🙂 otherwise we should close it as-is |
|
Release Notes Persisted
|
|
Sorry that we took so long, @nilayarya! We messed up on some PRs where we didn't respond. We're trying to do that better going forward. |
…#45934) * feat(macos): add --disable-geolocation-mac command-line flag * internally deny geolocation requests if flag set e * wrap PermissionRequestHandler instead * wrap custom handler and deny regardless of response * Update docs/api/command-line-switches.md Co-authored-by: Will Anderson <will@itsananderson.com> * resolving conflicts during rebase * tests added * tests added: minor changes * move IsGeolocationDisabledViaCommandLine inside ElectronPermissionManager as a static member * test: inject fixturesPath via --boot-eval * Update shell/browser/electron_permission_manager.cc Co-authored-by: Robo <hop2deep@gmail.com> * chore: Fixup after merge * fixup after merge --------- Co-authored-by: Will Anderson <will@itsananderson.com> Co-authored-by: Robo <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
…#45934) * feat(macos): add --disable-geolocation-mac command-line flag * internally deny geolocation requests if flag set e * wrap PermissionRequestHandler instead * wrap custom handler and deny regardless of response * Update docs/api/command-line-switches.md Co-authored-by: Will Anderson <will@itsananderson.com> * resolving conflicts during rebase * tests added * tests added: minor changes * move IsGeolocationDisabledViaCommandLine inside ElectronPermissionManager as a static member * test: inject fixturesPath via --boot-eval * Update shell/browser/electron_permission_manager.cc Co-authored-by: Robo <hop2deep@gmail.com> * chore: Fixup after merge * fixup after merge --------- Co-authored-by: Will Anderson <will@itsananderson.com> Co-authored-by: Robo <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
…#45934) * feat(macos): add --disable-geolocation-mac command-line flag * internally deny geolocation requests if flag set e * wrap PermissionRequestHandler instead * wrap custom handler and deny regardless of response * Update docs/api/command-line-switches.md Co-authored-by: Will Anderson <will@itsananderson.com> * resolving conflicts during rebase * tests added * tests added: minor changes * move IsGeolocationDisabledViaCommandLine inside ElectronPermissionManager as a static member * test: inject fixturesPath via --boot-eval * Update shell/browser/electron_permission_manager.cc Co-authored-by: Robo <hop2deep@gmail.com> * chore: Fixup after merge * fixup after merge --------- Co-authored-by: Will Anderson <will@itsananderson.com> Co-authored-by: Robo <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This causes Electron to not request GeoLocation services from macOS. We don't use it, and it looks bad to have it. The flag was added to a recent Electron version, so this change won't take effect until we update Electron. electron/electron#45934
This causes Electron to not request location services from macOS. We don't use it, and it looks bad to have it. The flag was added to a recent Electron version, so this change won't take effect until we update Electron. electron/electron#45934
This causes Electron to not request location services from macOS. We don't use it, and it looks bad to have it. The flag was added to a recent Electron version, so this change won't take effect until we update Electron. electron/electron#45934
This causes Electron to not request location services from macOS. We don't use it, and it looks bad to have it. The flag was added to a recent Electron version, so this change won't take effect until we update Electron. electron/electron#45934
Description of Change
Added a command line flag to opt-out of location services on macOS and prevent apps from listing themselves in location services.
Fixes: #32606
Checklist
npm testpassesRelease Notes
Notes: Added --disable-geolocation command-line flag for macOS apps to disable location services