Bug 1697714 [wpt PR 27950] - Custom State Pseudo Class: Fix iterators of internals...
commit8b96927328ca48917442da913efa1d54fdf75044
authorKent Tamura <tkent@chromium.org>
Wed, 17 Mar 2021 13:26:48 +0000 (17 13:26 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Fri, 19 Mar 2021 10:34:57 +0000 (19 10:34 +0000)
tree8f9b2371fe71fba767421f4a0190ba31fe0fdde5
parent6c583e822b08093a07b4302ac6295a1928aa6b3f
Bug 1697714 [wpt PR 27950] - Custom State Pseudo Class: Fix iterators of internals.states, a=testonly

Automatic update from web-platform-tests
Custom State Pseudo Class: Fix iterators of internals.states

internals.states.values() produced broken results if an item was
removed from internals.states after the iterator creation. Our
implementations used a collection class which did not support
modification while iteration.

This CL fixes it by updating the collection class from
LinkedHashSet<String> to Vector<String>. This makes operations of
internals.states O(N). However we expect people don't add huge
number of states to a single internals.states.

* Move the CustomStateIterationSource definition to the top of
  custom_state_set.cc so that CustomStateSet::deleteForBinding()
  recognizes methods of CustomStateIterationSource.

* CustomStateSet holds a set of CustomStateIterationSource because
  CustomStateSet should tell item deletion to
  CustomStateIterationSource instances.

Bug: 1184020
Change-Id: I20cd677b9ca3a10377daed1c0b51324b42b4771a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2744921
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#861855}

--

wpt-commits: cb34a01e7c225b9368130878da69e4f4855d90d7
wpt-pr: 27950
testing/web-platform/tests/custom-elements/state/tentative/ElementInternals-states.html