Skip to content

Marking promise rejections as handled #547

@domenic

Description

@domenic

See https://bugs.chromium.org/p/chromium/issues/detail?id=654701 for background /cc @yutakahirano @jakearchibald. Also #468 is kind of related, but that issue was about pipeTo which was confusing since pipeTo was under flux at the time.

A simple repro (run in Chrome) is

window.onunhandledrejection = e => {
  console.log(e.reason);
};

const rs = new ReadableStream({
  start(controller) {
    controller.close();
  }
});
const reader = rs.getReader();
reader.releaseLock();

This will log an unhandled rejection (and also show up in the console in Chrome, but that's a browser-specific devtools thing).

I think the correct solution is that all "state promises" like .closed should be marked as having their rejection handled (i.e. their [[PromiseIsHandled]] slot should be set to true).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions