From 5ccc2a957f885bb423bf3956a17f6840ec5d2f34 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 --- 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 b6403e812ec3a6..9cafdd4ef8e0f6 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()`