Open Bug 1780657 Opened 1 year ago Updated 1 year ago

Array.from returning empty from FontFaceSet Iterable


(Core :: DOM: CSS Object Model, defect)

Firefox 102




(Reporter:, Unassigned)


(Depends on 1 open bug)


Steps to reproduce:

Go to any page with fonts in Firefox, e.g.

Add the following into the console:

document.fonts.ready.then(function(fonts) {

Actual results:

An empty array is logged

Expected results:

Expect an array containing the FontFace for each item in the Iterable FontFaceSet

Summary: Array returning empty from FontFaceSet Iterable → Array.from returning empty from FontFaceSet Iterable

Note that fonts works as an Iterable: for (let font of document.fonts) { console.log(font) }

But fonts.values() does not: for (let font of document.fonts.values()) { console.log(font) }

Uncaught TypeError: document.fonts.values() is not iterable
    <anonymous> debugger eval code:1

The Bugbug bot thinks this bug should belong to the 'Core::JavaScript Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Component: JavaScript Engine → DOM: Core & HTML
Component: DOM: Core & HTML → DOM: CSS Object Model

Looks like our impl doesn't consider FontFaceSet to be an Iterable (but should).

See see bug 1729089 comment 2 and other comments there.

Until this is fixed, I think it can be worked around (somewhat clumsily) by manually calling "next()" on the object that fonts.values() returns -- it has a next() method, though it's not strictly an Iterable right now.

e.g. this should work in all browsers (and you could use similar code to construct an Array if you really want one as in comment 0):

document.fonts.ready.then(function(fonts) {
  kindaIterable = fonts.values();
  let count = 0;
  while (true) {
    let f =;
    if (f.done) {
      console.log("No more");
    console.log(`Found font in family: ${}`);
Severity: -- → S3
Depends on: 1729089
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.