v151 · web platform · fonts

Interface-Object Probe

Chrome used to mark FontFaceSet with [LegacyNoInterfaceObject], which hid the interface object: typeof FontFaceSet was "undefined" and you could not name the type even though document.fonts was one. Removing that extended attribute exposes the interface object on the global. This probe evaluates the exact expressions the change affects and reports what your browser returns right now.

live results from this browser
expressionexpected (Chrome 151+)this browser

what changed

An interface with [LegacyNoInterfaceObject] exists at runtime — objects can be that type — but the constructor name is never installed on the global object. That makes three things impossible: naming the type in code, checking instanceof against it, and reaching its prototype. Removing the attribute installs the interface object, so all three work:

typeof FontFaceSet                          // "function"  (was "undefined")
document.fonts instanceof FontFaceSet       // true        (was a TypeError: right-hand not callable)
FontFaceSet.prototype.check                 // function
Object.getPrototypeOf(document.fonts) === FontFaceSet.prototype  // true

Firefox and Safari already exposed FontFaceSet; this aligns Chrome with them and with the CSS Font Loading specification.

see also

references