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

javascript.{statements.for_await_of,builtins.Array.fromAsync} - data for closing sync iterables

Open Josh-Cena opened this issue 4 months ago • 1 comments

What type of issue is this?

Missing compatibility data

What information was incorrect, unhelpful, or incomplete?

See https://github.com/mdn/content/issues/37038: in https://github.com/tc39/ecma262/pull/2600, the behavior of the following code has changed:

function* generatorWithRejectedPromises() {
  try {
    yield 0;
    yield 1;
    yield Promise.resolve(2);
    yield Promise.reject(new Error("failed"));
    yield 4;
    throw new Error("throws");
  } finally {
    console.log("called finally");
  }
}

(async () => {
  try {
    for await (const num of generatorWithRejectedPromises()) {
      console.log(num);
    }
  } catch (e) {
    console.log("caught", e);
  }
})();

After the PR, we now log called finally. This affects at least for await...of and Array.fromAsync.

What browsers does this problem apply to, if applicable?

No response

What did you expect to see?

Data for when this became supported. Chrome supported this quite early, and latest Firefox supports this as well.

Did you test this? If so, how?

Running the above code.

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

No response

Do you have anything more you want to share?

No response

MDN URL

No response

MDN metadata

No response

Josh-Cena avatar Sep 01 '25 22:09 Josh-Cena

As for naming the subfeature, it could be closes_sync_iterator_when_async_wrapper_yields rejection (= PR title), or something shorter with this description.

After the PR, we now log called finally.

@Josh-Cena Can you add what happened before the PR?

Also, would you be available to contribute a custom BCD collector test? 🙏

caugner avatar Sep 10 '25 14:09 caugner