← Chrome 151 reference

v151 · css · fonts · web-idl · interop

Remove [LegacyNoInterfaceObject] from FontFaceSet IDL

Chrome 151 removes an incorrect [LegacyNoInterfaceObject] annotation from the FontFaceSet Web IDL, making FontFaceSet available as a global property in JavaScript. This aligns Chrome with Firefox, Safari, and the CSS Font Loading specification.

at a glance

Shipped inChrome 151 (Enabled by default)
StatusEnabled by default
SpecCSS Font Loading — FontFaceSet
Standards position (Firefox)Shipped/Shipping
Standards position (Safari)Shipped/Shipping
ChromeStatus5123999844663296 — Remove [LegacyNoInterfaceObject] from FontFaceSet IDL
Source: chromestatus.com/feature/5123999844663296

what changed and why

The Web IDL extended attribute [LegacyNoInterfaceObject] tells the browser not to expose an interface as a named property on the global object. Applied to FontFaceSet, it meant that self.FontFaceSet (and window.FontFaceSet) was undefined in Chrome, and the constructor property was absent from FontFaceSet.prototype.

This deviated from the CSS Font Loading specification, which does not include [LegacyNoInterfaceObject], and from Firefox and Safari where window.FontFaceSet is accessible. Chrome 151 removes the annotation, making the behaviour consistent.

Note on instantiation: because the IDL defines no constructor(), calling new FontFaceSet() continues to throw TypeError: Illegal constructor — this is correct spec-mandated behaviour. FontFaceSet instances are obtained via document.fonts, not by direct construction.

Source: chromestatus feature summary; CSS Font Loading spec

what changes

ExpressionChrome 149 and earlierChrome 151+
typeof FontFaceSet"undefined""function"
window.FontFaceSetundefinedThe FontFaceSet interface constructor
document.fonts instanceof FontFaceSetfalse (throws or returns false)true
new FontFaceSet()TypeErrorTypeError (no constructor defined — correct per spec)
Source: chromestatus feature summary

example

// Chrome 151+: FontFaceSet is accessible as a global
console.log(typeof FontFaceSet); // "function"

// Check if document.fonts is a FontFaceSet (now works cross-browser)
console.log(document.fonts instanceof FontFaceSet); // true

// Useful for type-checking / polyfill detection
if (typeof FontFaceSet !== 'undefined') {
  // FontFaceSet interface available
  document.fonts.ready.then(() => {
    console.log('All fonts loaded');
  });
}

// Still works (unchanged) — always use document.fonts, not new FontFaceSet()
const fonts = document.fonts;
fonts.add(new FontFace('MyFont', 'url(myfont.woff2)'));
Source: CSS Font Loading — FontFaceSet

browser support

BrowserSupportNotes
Chrome 151+Enabled by defaultFontFaceSet now a global property
FirefoxShippedAlready exposed FontFaceSet as a global
SafariShippedAlready exposed FontFaceSet as a global
Source: chromestatus.com/feature/5123999844663296

see also