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 in | Chrome 151 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Spec | CSS Font Loading — FontFaceSet |
| Standards position (Firefox) | Shipped/Shipping |
| Standards position (Safari) | Shipped/Shipping |
| ChromeStatus | 5123999844663296 — Remove [LegacyNoInterfaceObject] from FontFaceSet IDL |
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.
what changes
| Expression | Chrome 149 and earlier | Chrome 151+ |
|---|---|---|
typeof FontFaceSet | "undefined" | "function" |
window.FontFaceSet | undefined | The FontFaceSet interface constructor |
document.fonts instanceof FontFaceSet | false (throws or returns false) | true |
new FontFaceSet() | TypeError | TypeError (no constructor defined — correct per spec) |
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
| Browser | Support | Notes |
|---|---|---|
| Chrome 151+ | Enabled by default | FontFaceSet now a global property |
| Firefox | Shipped | Already exposed FontFaceSet as a global |
| Safari | Shipped | Already exposed FontFaceSet as a global |