Skip to content

Conversation

@kt3k
Copy link
Member

@kt3k kt3k commented Jun 10, 2025

This fixes EventEmitter.on behaviors and enables parallel/test-events-on-async-iterator.js test case.

Details:

  • Removing of AbortListener in EventEmitter.on wasn't working. This PR fixes it.
  • patches signal[kEvents] field if AbortSignal is passed to EventEmitter.on to let abort signal simulate Node.js EventTarget behavior. This field is used in the test case.
  • Added validation of options object in EventEmitter.on

towards #29595

@kt3k kt3k mentioned this pull request Jun 9, 2025
13 tasks
return new SafeMap();
}
return new SafeMap(
Object.entries(data.listeners).map((
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use primordial for Object.entries().

// This is necessary to pass `paralle/test-events-on-async-iterator.js` test
// TODO(kt3k): This can be removed if events.getEventListeners() is used
// instead of `signal[kEvents]` in upstream.
Object.defineProperty(signal, kEvents, kEventsGetter);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use primordial for Object.defineProperty

Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, two small nits

@kt3k kt3k merged commit dd91908 into denoland:main Jun 12, 2025
18 checks passed
@kt3k kt3k deleted the fix-ext-node-events-on branch June 12, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants