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: prevent navigator.fonts.query() from crashing #30930
Conversation
6bbcd7d
to
d3b3048
Compare
d3b3048
to
13a052b
Compare
Release Notes Persisted
|
I have automatically backported this PR to "14-x-y", please check out #30984 |
I have automatically backported this PR to "15-x-y", please check out #30985 |
base::PostTask( | ||
FROM_HERE, {content::BrowserThread::UI}, | ||
base::BindOnce( | ||
[](base::OnceClosure closure) { std::move(closure).Run(); }, | ||
std::move(close_callback))); |
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.
It seems like you could probably pass std::move(close_callback)
here rather than re-wrapping it, yes? i.e.
base::PostTask( | |
FROM_HERE, {content::BrowserThread::UI}, | |
base::BindOnce( | |
[](base::OnceClosure closure) { std::move(closure).Run(); }, | |
std::move(close_callback))); | |
base::PostTask(FROM_HERE, {content::BrowserThread::UI}, std::move(close_callback)); |
Please backport to Electron 13 as well @codebytere |
Description of Change
Closes #30884.
Follow-up at #30932.
Fixes a crash in
navigator.fonts.query()
. Chromium relies on a user choice via a UI they pop up to run the callback, and in contrast we don't really have a way to run the closure post-construction of the FontAccessChooser and therefore must run it in the constructor, which makes it such thatFontAccessManagerImpl::DidChooseLocalFonts
runs before theFontAccessChooser
is assigned in thechoosers_
map andDCHECK
S.As we don't yet have a standardized permissions model for this and similar APIs, this just mediates the crash and adds appropriate simple scaffolding for a proper implementation.
Tested with https://gist.github.com/bbae1d3b31214682fb6a05ec69b5d97a.
Checklist
npm test
passesRelease Notes
Notes: Fixed a crash in
navigator.fonts.query()
.