Skip to content

AbortSignal.addEventListener() throws on non-"abort" event names #5260

@Monti-27

Description

@Monti-27

AbortSignal is an EventTarget, so addEventListener() should not throw just because the event name is something other than "abort".

Right now Boa throws a TypeError here:

const ctrl = new AbortController();
ctrl.signal.addEventListener("whatever", () => {});

Current result:

TypeError: AbortSignal only supports the 'abort' event type

Expected behavior:

  • no throw
  • the listener is just never fired, since AbortSignal only dispatches abort

This looks like a small conformance bug in the current AbortSignal implementation. removeEventListener() already quietly ignores unknown event names, so addEventListener() throwing here is also a bit inconsistent with the rest of the API.

Relevant implementation:

  • core/runtime/src/abort/mod.rs

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