Skip to content

fix: fixed white flash on call to BrowserWindow.show#47151

Merged
codebytere merged 1 commit intoelectron:mainfrom
CezaryKulakowski:ckulakowski/white-flash-fix/1
Oct 14, 2025
Merged

fix: fixed white flash on call to BrowserWindow.show#47151
codebytere merged 1 commit intoelectron:mainfrom
CezaryKulakowski:ckulakowski/white-flash-fix/1

Conversation

@CezaryKulakowski
Copy link
Contributor

@CezaryKulakowski CezaryKulakowski commented May 19, 2025

Description of Change

Fixes #47149 by showing native NSView corresponding to window's content view before showing the window on a call to BrowserWindow.show/BrowserWindow.showInactive.

Checklist

Release Notes

Notes: fixed white flash on call to BrowserWindow.show

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label May 19, 2025
@VerteDinde VerteDinde added target/37-x-y PR should also be added to the "37-x-y" branch. semver/patch backwards-compatible bug fixes labels May 19, 2025
@deepak1556 deepak1556 added target/35-x-y PR should also be added to the "35-x-y" branch. target/36-x-y PR should also be added to the "36-x-y" branch. labels May 20, 2025
@deepak1556
Copy link
Member

Should this change be scoped only to macOS or is it fine to show webcontents before the window for all platforms ?

@CezaryKulakowski
Copy link
Contributor Author

Should this change be scoped only to macOS or is it fine to show webcontents before the window for all platforms ?

I think that - if there is not apparent reason for it - it's better to have the same code on both platforms. It does not cause any regressions on Windows according to spec tests.

@CezaryKulakowski
Copy link
Contributor Author

CezaryKulakowski commented May 20, 2025

There are following failures on macOS bot:

not ok 1523 WebContentsView setBorderRadius capture should render with cutout corners
  Expected color at (10, 10) to match '#0000ff', but got '#dadada'. See the artifact 'color-mismatch-9530684af33638ec6cd0ca7b.png' for more information.
  AssertionError: Expected color at (10, 10) to match '#0000ff', but got '#dadada'. See the artifact 'color-mismatch-9530684af33638ec6cd0ca7b.png' for more information.
      at ScreenCapture._expectImpl (electron/spec/lib/screen-helpers.ts:192:13)
      at Context.<anonymous> (electron/spec/api-web-contents-view-spec.ts:325:11)
not ok 1524 WebContentsView setBorderRadius capture should allow resetting corners
  Expected color at (10, 10) to match '#00b140', but got '#dadada'. See the artifact 'color-mismatch-36ed8e96c9df4c97bf337d5f.png' for more information.
  AssertionError: Expected color at (10, 10) to match '#00b140', but got '#dadada'. See the artifact 'color-mismatch-36ed8e96c9df4c97bf337d5f.png' for more information.
      at ScreenCapture._expectImpl (electron/spec/lib/screen-helpers.ts:192:13)
      at Context.<anonymous> (electron/spec/api-web-contents-view-spec.ts:338:9)
not ok 1525 WebContentsView setBorderRadius capture should render when set before attached
  Expected color at (10, 10) to match '#0000ff', but got '#dadada'. See the artifact 'color-mismatch-f172f29a661d387d09758905.png' for more information.
  AssertionError: Expected color at (10, 10) to match '#0000ff', but got '#dadada'. See the artifact 'color-mismatch-f172f29a661d387d09758905.png' for more information.
      at ScreenCapture._expectImpl (electron/spec/lib/screen-helpers.ts:192:13)
      at Context.<anonymous> (electron/spec/api-web-contents-view-spec.ts:354:9)

I can't repro it locally. All of them pass on my macOS with and without the fix. Are these tests flaky?

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label May 20, 2025
@nikwen
Copy link
Member

nikwen commented May 20, 2025

Don't know much about the tests.

Just a note that macOS tests run with reduced motion and reduced transparency:

defaults write com.apple.universalaccess reduceMotion -bool true
defaults write com.apple.universalaccess reduceTransparency -bool true

Might be the reason or might not be. Worth checking though.

(You can also set these settings in the macOS System Settings app).

@CezaryKulakowski
Copy link
Contributor Author

I believe all tests passed on the retest as I see all green now.

@CezaryKulakowski
Copy link
Contributor Author

I've pushed a fixup restoring check if window is not modal in BaseWindow. It's necessary as it's possible to create instance of BaseWindow which is not BrowserWindow.

@CezaryKulakowski
Copy link
Contributor Author

In the pipeline for a fixup I pushed earlier today following test failed on macOS:

not ok 832 webContents module printToPDF() with custom page sizes

This test doesn't even display any BrowserWindow so it's highly unlikely that my changes caused the problem. I am also not able to reproduce the problem on my mac. I can also see that there was a crash during testrun on Windows machine during one of the tests for ipc.

  1. Is it expected that spec tests fail like this?
  2. Will failed pipelines be retested automatically or some action from my side is required?

@nikwen
Copy link
Member

nikwen commented May 21, 2025

Looks like a flake. It happens sometimes (although we try to minimize it, of course).

Will failed pipelines be retested automatically or some action from my side is required?

Just comment and a maintainer will rerun. I just started a new test run.

@CezaryKulakowski
Copy link
Contributor Author

It failed again. This time following CHECK failed:

ok 928 chrome extensions chrome.webRequest does not take precedence over Electron webRequest - WebSocket
[2688:0521/165253.321:FATAL:content\browser\btm\btm_database.cc:150] sql::Database is not opened.

@CezaryKulakowski
Copy link
Contributor Author

Is there any additional work required from me to ge a review?

@nikwen
Copy link
Member

nikwen commented May 26, 2025

I'm not familiar enough with the code to review. (Someone else will get to it at some point.)

I think it would be nice to have a test though. That way, we can prevent it from regressing again in the future.

@CezaryKulakowski
Copy link
Contributor Author

I think it would be nice to have a test though. That way, we can prevent it from regressing again in the future.

I don't know if it's possible to write spec test which wouldn't be flaky as this is a very brief white flash.

@jkleinsc
Copy link
Member

@CezaryKulakowski can you sign your commits?

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

@CezaryKulakowski CezaryKulakowski force-pushed the ckulakowski/white-flash-fix/1 branch from 28dd17e to ff6a1c2 Compare May 29, 2025 10:55
@github-actions github-actions bot added the target/38-x-y PR should also be added to the "38-x-y" branch. label Jun 24, 2025
@codebytere
Copy link
Member

@CezaryKulakowski please rebase this!

@CezaryKulakowski CezaryKulakowski force-pushed the ckulakowski/white-flash-fix/1 branch from ff6a1c2 to 6877411 Compare June 25, 2025 13:53
@CezaryKulakowski
Copy link
Contributor Author

@CezaryKulakowski please rebase this!

I've just pushed a fix rebased to the newest master.

@codebytere
Copy link
Member

@CezaryKulakowski one last rebase and I'll get this merged. Sorry for the delay.

@CezaryKulakowski CezaryKulakowski force-pushed the ckulakowski/white-flash-fix/1 branch from 6877411 to e19002c Compare July 11, 2025 14:37
@CezaryKulakowski
Copy link
Contributor Author

@CezaryKulakowski one last rebase and I'll get this merged. Sorry for the delay.

done

@github-actions github-actions bot added the target/39-x-y PR should also be added to the "39-x-y" branch. label Sep 3, 2025
@CezaryKulakowski
Copy link
Contributor Author

Closing the fix as the bug has been closed as "closed as not planned". I'm going to keep the fix in our repo as a patch to Electron.

@CezaryKulakowski
Copy link
Contributor Author

CezaryKulakowski commented Oct 14, 2025

Is there anything preventing us from merging it?

@codebytere codebytere merged commit 357e42d into electron:main Oct 14, 2025
58 checks passed
@release-clerk
Copy link

release-clerk bot commented Oct 14, 2025

Release Notes Persisted

fixed white flash on call to BrowserWindow.show

@trop
Copy link
Contributor

trop bot commented Oct 14, 2025

I have automatically backported this PR to "37-x-y", please check out #48558

@trop trop bot added in-flight/37-x-y and removed target/37-x-y PR should also be added to the "37-x-y" branch. labels Oct 14, 2025
@trop
Copy link
Contributor

trop bot commented Oct 14, 2025

I have automatically backported this PR to "39-x-y", please check out #48559

@trop
Copy link
Contributor

trop bot commented Oct 14, 2025

I have automatically backported this PR to "38-x-y", please check out #48560

@trop trop bot added in-flight/39-x-y in-flight/38-x-y merged/39-x-y PR was merged to the "39-x-y" branch. merged/37-x-y PR was merged to the "37-x-y" branch. merged/38-x-y PR was merged to the "38-x-y" branch. and removed target/39-x-y PR should also be added to the "39-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. in-flight/39-x-y in-flight/37-x-y in-flight/38-x-y labels Oct 14, 2025
TheCommieAxolotl pushed a commit to TheCommieAxolotl/electron that referenced this pull request Nov 2, 2025
nilayarya pushed a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/37-x-y PR was merged to the "37-x-y" branch. merged/38-x-y PR was merged to the "38-x-y" branch. merged/39-x-y PR was merged to the "39-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

White flash on call to BrowserWindow.show

6 participants