Regression: v39 incorrectly resolves the system theme (light/dark) at runtime and also calculates nativeTheme.shouldUseDarkColors incorrectly at runtime
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 a bug report that matches the one I want to file, without success.
Electron Version
39.0.0
What operating system(s) are you using?
Other Linux
Operating System Version
Archlinux + KDE + Wayland
What arch are you using?
x64
Last Known Working Electron version
38.5.0, 39.0.0-alpha.5 (broken in 39.0.0-alpha.6, https://github.com/electron/electron/compare/v39.0.0-alpha.5...v39.0.0-alpha.6)
The Chromium v142 upgrade caused the regression. v38.x is working correctly.
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
When I change the system theme (I'm using latest KDE Plasma v6.5.1 + Wayland), electron should be able to recognize it at runtime. It currently recognizes it correctly on startup, but doesn't work if the system theme is changed during runtime.
Actual Behavior
When I change the system theme at runtime (electron app running), electron v39 doesn't correctly recognize the theme. shouldUseDarkColors is reported incorrectly (inverse). This causes things like "window.matchMedia('(prefers-color-scheme: dark)');" to be reported incorrectly. This is very recent regression as this works perfectly fine when I revert back to using any v38.x.
Testcase Gist URL
https://gist.github.com/lone-cloud/2211e0b707c8c8771eb060d9ad9c403f
Additional Information
No response
Source: electron/electron