lib: let abort_controller target be EventTarget

The AbortController abort event should have EventTarget as a target
property of the argument event.

PR-URL: https://github.com/nodejs/node/pull/35869
Refs: https://github.com/web-platform-tests/wpt/blob/master/dom/abort/event.any.js
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
Daijiro Wachi authored and Michaël Zasso committed 2020-11-03 17:54:21 +01:00
1 parent 1303a1fca8
commit d2f574b5be
2 files changed
+4 -6

No files matched your search

+2 -3
View File
@@ -10,6 +10,7 @@ const {
} = primordials;
const {
defineEventHandler,
EventTarget,
Event,
kTrustEvent
@@ -53,9 +54,6 @@ function abortSignal(signal) {
const event = new Event('abort', {
[kTrustEvent]: true
});
if (typeof signal.onabort === 'function') {
signal.onabort(event);
}
signal.dispatchEvent(event);
}
@@ -67,6 +65,7 @@ class AbortController {
constructor() {
this[kSignal] = new AbortSignal();
emitExperimentalWarning('AbortController');
defineEventHandler(this[kSignal], 'abort');
}
get signal() { return this[kSignal]; }
+2 -3
View File
@@ -334,14 +334,13 @@ class EventTarget {
}
return event;
};
if (event !== undefined)
event[kTarget] = this;
const root = this[kEvents].get(type);
if (root === undefined || root.next === undefined)
return true;
if (event !== undefined)
event[kTarget] = this;
let handler = root.next;
let next;