From f08e2c021372442d1ff4e6e8cdf85d3bd48a6c18 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Mon, 26 Oct 2020 13:56:48 +0200 Subject: [PATCH] events: make abort_controller event trusted The AbortController abort event is trusted, currently we fire all events with isTrusted: false. Allow dispatching events internally with `isTrusted: true` and add a test for it. Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Fixes: https://github.com/nodejs/node/issues/35748 PR-URL: https://github.com/nodejs/node/pull/35811 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/events.md | 5 ++-- lib/internal/abort_controller.js | 7 +++-- lib/internal/event_target.js | 15 ++++++++++- lib/internal/per_context/primordials.js | 4 +++ test/parallel/test-abortcontroller.js | 34 ++++++++++++++++++++++++- 5 files changed, 59 insertions(+), 6 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index a46fa06042cc2b..17420a249be731 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1282,9 +1282,10 @@ This is not used in Node.js and is provided purely for completeness. added: v14.5.0 --> -* Type: {boolean} Always returns `false`. +* Type: {boolean} True for Node.js internal events, false otherwise. -This is not used in Node.js and is provided purely for completeness. +Currently only `AbortSignal`s' `"abort"` event is fired with `isTrusted` +set to `true`. #### `event.preventDefault()`