From 9fed98cee53abe2248dbc01452a5bb48288a7a77 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Fri, 13 Feb 2026 01:27:37 -0800 Subject: [PATCH] chore: cherry-pick e045399a1ecb from chromium (#49792) * chore: cherry-pick e045399a1ecb from chromium * chore: update patch * chore: fix older method in patch --- patches/chromium/.patches | 1 + .../chromium/cherry-pick-e045399a1ecb.patch | 133 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 patches/chromium/cherry-pick-e045399a1ecb.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 4eef93ee89..af4673d9a5 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -140,3 +140,4 @@ band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch inspectorpageagent_provisional_frame_speculative_fix.patch expose_referrerscriptinfo_hostdefinedoptionsindex.patch fix_release_mouse_buttons_on_focus_loss_on_wayland.patch +cherry-pick-e045399a1ecb.patch diff --git a/patches/chromium/cherry-pick-e045399a1ecb.patch b/patches/chromium/cherry-pick-e045399a1ecb.patch new file mode 100644 index 0000000000..573310aa6f --- /dev/null +++ b/patches/chromium/cherry-pick-e045399a1ecb.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dominik=20R=C3=B6ttsches?= +Date: Thu, 12 Feb 2026 06:35:36 -0800 +Subject: Avoid stale iteration in CSSFontFeatureValuesMap +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +To avoid invalid iterator state, take a snapshot of the +map when creating the iteration source. This addresses +the immediate problem of iterating while modifying. + +Remaining work tracked in https://crbug.com/483936078 + +Fixed: 483569511 +Change-Id: Ie29cfdf7ed94bbe189b44c842a5efce571bb2cee +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566570 +Commit-Queue: Dominik Röttsches +Reviewed-by: Anders Hartvoll Ruud +Cr-Commit-Position: refs/heads/main@{#1583927} + +diff --git a/third_party/blink/renderer/core/css/css_font_feature_values_map.cc b/third_party/blink/renderer/core/css/css_font_feature_values_map.cc +index 24303069e2531afebec29977378ba708051e117d..1862dae14a63769f0fe1fe1cf5f6f880148ce37b 100644 +--- a/third_party/blink/renderer/core/css/css_font_feature_values_map.cc ++++ b/third_party/blink/renderer/core/css/css_font_feature_values_map.cc +@@ -13,17 +13,16 @@ class FontFeatureValuesMapIterationSource final + : public PairSyncIterable::IterationSource { + public: + FontFeatureValuesMapIterationSource(const CSSFontFeatureValuesMap& map, +- const FontFeatureAliases* aliases) +- : map_(map), aliases_(aliases), iterator_(aliases->begin()) {} ++ const FontFeatureAliases aliases) ++ : map_(map), ++ aliases_(std::move(aliases)), ++ iterator_(aliases_.begin()) {} + + bool FetchNextItem(ScriptState* script_state, + String& map_key, + Vector& map_value, + ExceptionState&) override { +- if (!aliases_) { +- return false; +- } +- if (iterator_ == aliases_->end()) { ++ if (iterator_ == aliases_.end()) { + return false; + } + map_key = iterator_->key; +@@ -38,9 +37,13 @@ class FontFeatureValuesMapIterationSource final + } + + private: +- // Needs to be kept alive while we're iterating over it. + const Member map_; +- const FontFeatureAliases* aliases_; ++ // Create a copy to keep the iterator from becoming invalid if there are ++ // modifications to the aliases HashMap while iterating. ++ // TODO(https://crbug.com/483936078): Implement live/stable iteration over ++ // FontFeatureAliases by changing its storage type, avoiding taking a copy ++ // here. ++ const FontFeatureAliases aliases_; + FontFeatureAliases::const_iterator iterator_; + }; + +@@ -50,8 +53,8 @@ uint32_t CSSFontFeatureValuesMap::size() const { + + PairSyncIterable::IterationSource* + CSSFontFeatureValuesMap::CreateIterationSource(ScriptState*, ExceptionState&) { +- return MakeGarbageCollected(*this, +- aliases_); ++ return MakeGarbageCollected( ++ *this, aliases_ ? *aliases_ : FontFeatureAliases()); + } + + bool CSSFontFeatureValuesMap::GetMapEntry(ScriptState*, +diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/font_feature_values_map_iteration.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/font_feature_values_map_iteration.html +new file mode 100644 +index 0000000000000000000000000000000000000000..eac7198b0b4a58007cbcc77ad3e9357a1009117c +--- /dev/null ++++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/font_feature_values_map_iteration.html +@@ -0,0 +1,52 @@ ++ ++ ++ ++ CSSFontFeatureValuesMap Iteration and Modification ++ ++ ++ ++ ++ ++ ++ ++ ++ ++