Prevent key repeats from triggering the save panel

提交: bf4170bc | 2026-05-18 19:13:16

← 返回列表

Prevent key repeats from triggering the save panel

Minor
提交哈希: bf4170bc5dc1d0dddf26d57645aa3c8fcd9aaf90
提交时间: 2026-05-18 19:13:16
影响等级: Minor
生成工具: chromium-watcher
上游审核链接: 查看上游审核 🔗

📋 摘要

This commit extends the SelectFileDialogDelegate (which blocks key-repeat-driven dialog dismissal) from open panels only to save panels as well.
Specific changes: 1) Moved delegate_ creation and assignment from the open-only branch to a common location so it covers NSSavePanel too;
2) Reorganized the @interface/@implementation ordering of SelectFileDialogDelegate (declaration immediately followed by implementation);
3) Added a reference to crbug.com/514070501 in the validateURL: comment.

🎯 影响分析

The impact on WebView2Mac is minor. SelectFileDialogBridge is the remote_cocoa bridge class for file dialogs,
used indirectly in WebView2Mac through HostingNSWindowBridge. This change only moves the delegate assignment
from the open-panel-only branch to a common location covering both open and save panels — a security hardening change.

The downstream Edge code (Q:/Edge/src/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm, lines 481-482)
currently uses the old pattern — delegate is set only in the open_dialog branch. After merging this upstream change,
the save panel will also gain key-repeat protection with no compatibility concerns. However, Edge's custom
"Upload from Phone" button logic exists in the same code region, so merge conflicts should be expected and
handled carefully.

受影响的类:

remote_cocoa::SelectFileDialogBridge SelectFileDialogDelegate