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
fix: geolocation crashes electron on macOS #29913
Conversation
@omarkilani has manually backported this PR to "14-x-y", please check out #29914 |
@omarkilani has manually backported this PR to "13-x-y", please check out #29912 |
Thanks for the PR, couple of changes:
|
@deepak1556 yup, was making that main parts change already. Just wasn’t sure if the goal was to minimize the number of files touched or what the project rules were for calling out to main parts from browser client since nothing was doing that already. It takes me like 4-5 hours to build on one branch so… I’ll try to get that done soon. I think 2 only applies to the main and 14-x-y branches. Is that your view? My focus was on the 13-x-y branch and that’s sort of what I tested comprehensively with. I did need to codesign with my own Developer ID for it to work, but didn’t need to add that entitlement. Do you want the main parts bit to match headless on all the branches? |
Yes please match the change on all the branches.
Did you setup electron with https://github.com/electron/build-tools ? It should provide read only compile cache that should speed up builds.
The backend was enabled by default first in chromium 87 https://chromium-review.googlesource.com/c/chromium/src/+/2411302 , so
Just to confirm, did you codesign for hardened runtime ? |
Okay.
Ah, that's handy. Thanks! I've never needed to compile Electron before so... there's a lot to learn. :) Actually I ended up hacking ninja directly to hash the file contents and ignore the mtime because I accidentally ran
Okay.
Nope. We don't publish on MAS so it's not something I regularly test. I tested my build of what's over here: https://app.circleci.com/pipelines/github/electron/electron/41700/workflows/bbe3b3bc-c4fa-45c3-9551-c369e899cbde/jobs/927113/artifacts And used it with electron-builder to test our own app's Geolocation functionality with a Google API key. Seemed to work exactly like the 12.x releases. I also tested it against all the various test cases in the linked issue. |
Okay, I think I'm done on all 3 branches code-wise. It's as close to headless as possible. |
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.
LGTM with minor change.
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
Description of Change
Geolocation was crashing in Release builds with a backtrace that seemed to implicate WASM SIMD.
And because Chrome 91 enabled WASM SIMD by default and the crash occurred between 13.0.0-beta13 and 13.0.0-beta14 (66a2218#diff-42a9b04f836798e53829385d847f016f600b92336c532d9c7f7a18acc4937d26L118), it seemed to be the culprit and sort of lead me down the wrong path.
However, when dSYMs were available and loaded into lldb, it was able to produce a real backtrace:
One of the participants in #29343, @TheCleric, happened to stumble upon a Chrome commit that seemed related.
Chrome had merged a change to NetworkLocationProvider:
https://chromium.googlesource.com/chromium/src/+/36d366175fee2d4f0fd0a8ccf53338984da9b531%5E%21/
That had caused a crash in headless Chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=1195664&q=OS%3DMac%20component%3ABlink%3EGeolocation&can=1
For which a fix was committed:
https://chromium.googlesource.com/chromium/src/+/39cabc596fccd3e79b71cd8ddd0f3348cc2975d9%5E%21/
The reason it affected Electron past 13.0.0-beta13 was because 13.0.0-beta14 bumped Chromium to 91.0.4448.0 , while the changed was landed in Chromium 91.0.4437.0:
https://chromiumdash.appspot.com/commit/36d366175fee2d4f0fd0a8ccf53338984da9b531
This PR / commit implements an Electron specific version of this fix, modified for changes to GeolocationManager in Chrome 93.
I've tested the fix for cases where no system permissions have been granted, where system permissions have been granted with no Google API key, and where system permissions have been granted with a Google API key. Seems to work like it used to.
Closes #29343
Checklist
Release Notes
Notes: Fixed crashes on macOS when
Geolocation
was used.