Open Bug 2030981 Opened 3 months ago Updated 28 days ago

Use DOM-accessible data storage for maplike/setlike

Categories

(Core :: DOM: Bindings (WebIDL), task)

task

Tracking

()

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Currently, our implementation for the maplike/setlike webidl concepts use Spidermonkey datastructures to store the data. This makes it inaccessible from DOM code, leading to parallel data structures, which is both inefficient and error prone.

Blocks: 2030984

Previously, WebIDL setlike/maplike interfaces were backed by a JS Set/Map
stored in a reserved slot, making their data inaccessible from C++. Every
interface had to maintain a parallel C++ mirror and manually keep it in sync.

This patch introduces the [DOMBackedStorage] WebIDL extended attribute as an
explicit opt-in that switches a setlike/maplike declaration to use a C++-owned
ECMASet/ECMAMap as the backing store. Interfaces that opt in must inherit
SetlikeMixin<T> or MaplikeMixin<K, V> directly to expose SetData()/MapData().

  • CGECMACollectionMethodGenerator generates method bodies that call directly
    into the C++ data structure for [DOMBackedStorage] interfaces
  • Physical-index iterators (ECMACollectionIterator.h) provide ES-compatible
    mutation-during-iteration semantics
  • Interfaces without [DOMBackedStorage] continue to use the JS-backed path
See Also: → 2049425
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: