In bug #239853 we implemented reflection for FrozenArray<Element> attributes following the spec text at:
However the implementation doesn't match one of the things in the spec:
> This extra caching layer is necessary to preserve the invariant that element.reflectedElements === element.reflectedElements.
We don't have an extra caching layer so we can return the very same array in this case. The contents of the arrays are the same but the previous condition is false.
I'm not really sure how we could implemented that, as we're storing the "explicitly set attr-elements" using "HashMap<QualifiedName, Vector<WeakPtr<Element>>>" but Element::getElementsArrayAttribute() returns "Vector<RefPtr<Element>>". I'm not sure if we can cache the latter somehow without causing memory leaks.
Domenic suggested that ObservableArray could fix this issue (see https://github.com/web-platform-tests/wpt/pull/34095#discussion_r875333836), but we don't have support yet (bug #238281).
Any advice about how we can solve this issue? Thanks!
cdumez@ suggested to use JSValueInWrappedObject to fix this issue. I'll give that a try. Thanks.
Pull request with the patch: https://github.com/WebKit/WebKit/pull/974
Committed r295148 (251237@main): <https://commits.webkit.org/251237@main>
Reviewed commits have been landed. Closing PR #1166 and removing active labels.