browser-compat-data icon indicating copy to clipboard operation
browser-compat-data copied to clipboard

`api.FontFaceSet.values()`/`.entries()` - Not actually iterable on Firefox

Open jjspace opened this issue 5 months ago • 0 comments

What type of issue is this?

Browser bug (a bug with a feature that may impact site compatibility)

What information was incorrect, unhelpful, or incomplete?

The compatibility tables claim full support but it's actually broken in Firefox.

The pages for FontFaceSet.values() and FontFaceSet.entries() say they return an iterator object. I think it's a safe assumption that this can be used like any other iterator to do things like construct an array of values.

However in Firefox there seems to be a bug where their FontFaceSetIterator object is not actually setlike and throws an error that Uncaught TypeError: document.fonts.values() is not iterable.

These are the best bug tracker issues I could find

  • https://bugzilla.mozilla.org/show_bug.cgi?id=1780657
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1311198

What browsers does this problem apply to, if applicable?

Firefox

What did you expect to see?

Some sort of warning that these functions will not behave as expected of iterators in the current version of Firefox. At least the * that's added on other compat tables to show there's a bug. Maybe even as far as reducing FF back to the yellow status but that might be overkill, I don't know all the rules for that.

Did you test this? If so, how?

  • Open any page with fonts, like this github page.
  • Open the console and use any of the below lines to test
// this works
[...document.fonts]
// this fails "Uncaught TypeError: document.fonts.values() is not iterable"
[...document.fonts.values()]
// this also fails "Uncaught TypeError: document.fonts.entries() is not iterable"
[...document.fonts.entries()]

// can also be triggered by loops:
for (let font of document.fonts.values()) {
  //...
}

// It also "fails" to construct with Array.from() as seen in the FF bug above
Array.from(document.fonts.values()) // Returns [] instead of the full array

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

  • https://bugzilla.mozilla.org/show_bug.cgi?id=1780657
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1311198

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/values

MDN metadata

MDN page report details
  • Query: api.FontFaceSet.values
  • Report started: 2025-10-06T17:10:25.825Z

jjspace avatar Oct 06 '25 17:10 jjspace