[Webkit-unassigned] [Bug 240563] New: Reflection for FrozenArray<Element> caching invariant

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 18 00:18:50 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=240563

            Bug ID: 240563
           Summary: Reflection for FrozenArray<Element> caching invariant
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rego at igalia.com
                CC: cdumez at apple.com, rniwa at webkit.org
            Blocks: 196843

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!


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=196843
[Bug 196843] Implement IDREF element reflection
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220518/d79b0ec9/attachment-0001.htm>


More information about the webkit-unassigned mailing list