Revert "Restore windows to spaces on a system restart"

Commit: 5942d564 | 2026-03-18 15:49:31

← Back to List

Revert "Restore windows to spaces on a system restart"

Minor
Commit Hash: 5942d5648342d9e0c78439b692280768485182b6
Commit Time: 2026-03-18 15:49:31
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This commit reverts commit 51341b3f92d8 (Restore windows to spaces on a system restart) because it likely caused bug 493833255. The revert includes:
1. Removed the _handleCoreEvent:withReplyEvent: override from BrowserCrApplication, which detected system restarts by intercepting the keyAERestoreAppState parameter from kCoreEventClass AppleEvents.
2. Reverted the static method on NativeWidgetMacNSWindowHost from MoveWindowsToOriginalSpacesUponRestoration() back to SetMoveWindowsToOriginalSpacesUponRestoration(bool).
3. Restored the call in ChromeBrowserMainPartsMac to pass the kWasRestarted boolean value.
4. Removed TODO comments and related includes from chrome/app_shim/app_shim_application.mm and chrome_browser_application_mac.mm.

🎯 Impact Analysis

The impact of this change on WebView2Mac is minimal. Key analysis:

1. **Restores to a previously known stable state**: This revert restores the NativeWidgetMacNSWindowHost API to SetMoveWindowsToOriginalSpacesUponRestoration(bool), which matches the version currently in the Edge repo. This revert effectively eliminates the API change that would have been introduced by integrating the reverted commit.

2. **Reverted code was all in Chrome browser layer**: The removed _handleCoreEvent:withReplyEvent: override was in BrowserCrApplication, which is not in WebView2Mac's code path. WebView2Mac does not use BrowserCrApplication or AppShimApplication.

3. **WebView2Mac does not involve space restoration**: Consistent with this series of commits (daf1cc3, f9a6ce0, 51341b3), WebView2Mac's embedded windows do not use the independent workspace restoration mechanism, and state_restoration_data is typically empty in WebView2Mac scenarios.

4. **Impact on Edge integration**: Since this revert restores the API signature consistent with the Edge repo, if Edge plans to integrate this series of commits, it should note that the reverted commit (51341b3) has been withdrawn to avoid introducing known problematic code.

Impacted Classes:

views::NativeWidgetMacNSWindowHost BrowserCrApplication