v151 · web platform · fonts

Remove [LegacyNoInterfaceObject] from FontFaceSet IDL

Chrome previously used [LegacyNoInterfaceObject] on FontFaceSet, hiding it as a global and deleting its constructor. This change exposes FontFaceSet globally — aligning with the CSS Font Loading spec and Firefox/Safari.

concepts

  1. Interface-Object Probe

    Evaluate the exact expressions this change affects — typeof FontFaceSet, document.fonts instanceof FontFaceSet, FontFaceSet.prototype.check — and see live what your browser returns in a pass/fail table.

  2. instanceof Guards

    Exposing the interface object is what makes value instanceof FontFaceSet legal. Run a real type-guard against document.fonts, a FontFace, a plain Set, and more — the check that used to throw a TypeError now works.

  3. Live Font Loader

    Exercise the FontFaceSet API whose type is now nameable: check(), ready, iterate the set, and dynamically load() and add() a new FontFace at runtime.

why it shipped

[LegacyNoInterfaceObject] is a legacy Web IDL escape hatch that keeps an interface's constructor off the global object. It made FontFaceSet un-nameable in Chrome — you could hold one via document.fonts but never write instanceof FontFaceSet or reach FontFaceSet.prototype. Firefox and Safari already exposed it; removing the attribute aligns Chrome with them and with the CSS Font Loading specification, and unblocks precise instanceof type guards in libraries.

references