Ignore out-of-order text replacement to avoid crashes

Commit: d5bf4ba9 | 2025-03-04 20:08:36+00:00

← Back to List

Ignore out-of-order text replacement to avoid crashes

Minor
Commit Hash: d5bf4ba9cd66ce8bc28939a6807777403f295259
Commit Time: 2025-03-04 20:08:36+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission mainly modifies the content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm file, renaming member variables related to text replacement (such as changing _availableTextChangeCounter to _availableTextChangeNumber), and adjusts the text replacement process to ensure that WebContents can ignore text corrections targeting outdated versions of text, thereby preventing crashes. The core logic is to discard obsolete text replacement requests by comparing the change number.

🎯 Impact Analysis

This change optimizes the robustness of text replacement (such as spell check/auto-correction), preventing WebContents crashes caused by asynchronous or out-of-order text replacement requests. For WebView2Mac, if downstream implementations directly reuse RenderWidgetHostViewCocoa or its related text input/replacement mechanisms, this fix can improve stability and reduce the risk of crashes caused by unsynchronized text states. If WebView2Mac only indirectly depends on or does not customize the relevant processes, the impact is minimal. Overall, this change does not affect the Remote Cocoa interfaces, Mojo communication protocol, or core window/view bridging logic, and is limited to improvements in the robustness of text input and replacement.

Impacted Classes:

RenderWidgetHostViewCocoa