Closed Bug 2063137 Opened 3 months ago Closed 3 months ago

[wpt-sync] Sync PR 61890 - [highlights] Preserve insertion order when setting an existing name

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
firefox156 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 61890 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/61890
Details from upstream follow.

Fernando Fiori <ffiori@microsoft.com> wrote:

[highlights] Preserve insertion order when setting an existing name

HighlightRegistry is a maplike\<DOMString, Highlight>, so setForBinding()
must follow Map.prototype.set semantics: when the name is already in the
registry, the value is replaced and the order of entries is not affected
(ECMA-262 24.1.3.9).

Instead, HighlightRegistry::SetForTesting() erased the existing entry
and inserted a new one, which moved it to the end of the
HeapLinkedHashSet and therefore to the end of the iteration order. Two
consequences:

  • CSS.highlights.keys()/values()/entries() reported the wrong order
    after overwriting an existing name.
  • Overwriting the name an iterator is currently pointing at moved that
    entry behind the cursor, so the iteration restarted and never
    terminated.

Update the existing entry in place instead. The registration position is
still bumped, so the highlight keeps stacking above previously
registered ones (highlights are stacked with
CompareOverlayStackingPosition(), which reads registration_position and
not the position in the set), and painting behavior is unchanged.
Notifying the iterators is no longer needed because nothing is removed:
they keep pointing at the same entry.

Bug: 544197475
Change-Id: I79b44f4c39b86a658e6e26b86c8e5c94b2cdff6b

Reviewed-on: https://chromium-review.googlesource.com/8227847
WPT-Export-Revision: 72b551347357c599310ba25df822550af93a60bf

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 122 tests

Status Summary

Firefox

OK : 2[GitHub] 18[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 4[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 11[GitHub] 166[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 260[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 6

Chrome

OK : 2
PASS: 8
FAIL: 3

Safari

OK : 2
PASS: 11

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7242be1d6af3 https://hg.mozilla.org/integration/autoland/rev/833e64ad2ecf [wpt PR 61890] - [highlights] Preserve insertion order when setting an existing name, a=testonly
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch
You need to log in before you can comment on or make changes to this bug.