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
AbortSignalis anEventTarget, soaddEventListener()should not throw just because the event name is something other than"abort".Right now Boa throws a
TypeErrorhere:Current result:
Expected behavior:
AbortSignalonly dispatchesabortThis looks like a small conformance bug in the current
AbortSignalimplementation.removeEventListener()already quietly ignores unknown event names, soaddEventListener()throwing here is also a bit inconsistent with the rest of the API.Relevant implementation:
core/runtime/src/abort/mod.rs