Ignore out-of-order text replacement to avoid crashes
Minor
提交哈希:
d5bf4ba9cd66ce8bc28939a6807777403f295259
提交时间: 2025-03-04 20:08:36+00:00
影响等级: Minor
生成工具: webview2-upstream-sentry
上游审核链接:
查看上游审核 🔗
📋 摘要
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.
🎯 影响分析
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.
受影响的类:
RenderWidgetHostViewCocoa