RESOLVED FIXED 240563
Reflection for FrozenArray<Element> caching invariant
https://bugs.webkit.org/show_bug.cgi?id=240563
Summary Reflection for FrozenArray<Element> caching invariant
Manuel Rego Casasnovas
Reported 2022-05-18 00:18:50 PDT
In bug #239853 we implemented reflection for FrozenArray<Element> attributes following the spec text at: https://github.com/whatwg/html/pull/3917 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!
Attachments
Manuel Rego Casasnovas
Comment 1 2022-05-19 12:40:35 PDT
cdumez@ suggested to use JSValueInWrappedObject to fix this issue. I'll give that a try. Thanks.
Manuel Rego Casasnovas
Comment 2 2022-05-24 22:52:38 PDT
Pull request with the patch: https://github.com/WebKit/WebKit/pull/974
Radar WebKit Bug Importer
Comment 3 2022-05-25 00:19:13 PDT
EWS
Comment 4 2022-06-02 14:45:53 PDT
Committed r295148 (251237@main): <https://commits.webkit.org/251237@main> Reviewed commits have been landed. Closing PR #1166 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.