Use case: we use fullscreen with additional options to put users into a 'kiosk'/secured mode. This issue is only on MacOS Big Sur/Monterey; Windows 10/11 & Ubuntu do not exhibit this behavior.
With 4951 and prior versions going back at least as far as 3729, we could turn on a slew of fullscreen options at the very end of root_window_mac.mm's RootWindowMacImpl::CreateRootWindow method, and the app would go to fullscreen mode and the browser's content would reliably be visible.
Starting with CEF 5005, there's about a 50% chance of the browser content being visible, otherwise a white screen is shown, which seems to be the root window. Without the other presentation options active, I can press Command+backtick to toggle between the browser and the root, so the browser window is there but isn't at the forefront like it used to be. So the app isn't crashing, but there does seem to now be a race condition on whether the browser window is visible upon invoking the fullscreen. I am able to reproduce in cefclient and I pared down the options to just the bare minimum.
Interestingly, I NEVER encounter the race condition/whitescreen issue when I open the app from a terminal-- the issue ONLY happens when invoked from Finder or XCode, and not consistently, but as mentioned, maybe 40-60% of the time. Maybe something about launchd invocation or relative paths somewhere down within chromium is different? Maybe I should be invoking fullscreen in a different manner or location?
- Code: Select all
void RootWindowMacImpl::CreateRootWindow(const CefBrowserSettings& settings,
bool initially_hidden) {
REQUIRE_MAIN_THREAD();
.
.
.
if (!initially_hidden) {
// Show the window.
Show(RootWindow::ShowNormal);
// fullscreen additions ------------------------->>
NSApplicationPresentationOptions options =
[NSApp presentationOptions]; // |
// additional options we use but which aren't needed to reproduce issue
// NSApplicationPresentationFullScreen;
// NSApplicationPresentationHideDock |
// NSApplicationPresentationHideMenuBar |
// NSApplicationPresentationDisableAppleMenu |
// fair warning: don't uncomment this one until issue is resolved or you enjoy hard restart in safe mode
// NSApplicationPresentationDisableProcessSwitching;
NSDictionary *fullScreenOptions = @{NSFullScreenModeApplicationPresentationOptions: @(options)};
[window_ setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
// [window_ setLevel:CGShieldingWindowLevel()];
[[window_ contentView] enterFullScreenMode:GetOriginScreen() withOptions:fullScreenOptions];
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
// end fullscreen additions ------------------------->>
}
Side note: for my local testing of MacOS cefclient (and our production derivative), I also edited cefclient_mac.mm's tryToTerminateApplication method by adding exit(0); because of a close/quit issue that we originally saw on linux but now see happening in MacOS (4951 & 5005).