Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f74c2fc

Browse filesBrowse files
atlowChemiruyadorno
authored andcommitted
lib: use addAbortListener
PR-URL: #48550 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent b5df084 commit f74c2fc
Copy full SHA for f74c2fc

File tree

Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/abort_controller.js‎

Copy file name to clipboardExpand all lines: lib/internal/abort_controller.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const {
2323
kTrustEvent,
2424
kNewListener,
2525
kRemoveListener,
26+
kResistStopPropagation,
2627
kWeakHandler,
2728
} = require('internal/event_target');
2829
const {
@@ -447,7 +448,8 @@ async function aborted(signal, resource) {
447448
if (signal.aborted)
448449
return PromiseResolve();
449450
const abortPromise = createDeferredPromise();
450-
signal.addEventListener('abort', abortPromise.resolve, { [kWeakHandler]: resource, once: true });
451+
const opts = { __proto__: null, [kWeakHandler]: resource, once: true, [kResistStopPropagation]: true };
452+
signal.addEventListener('abort', abortPromise.resolve, opts);
451453
return abortPromise.promise;
452454
}
453455

Collapse file

‎lib/internal/watch_mode/files_watcher.js‎

Copy file name to clipboardExpand all lines: lib/internal/watch_mode/files_watcher.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const { fileURLToPath } = require('url');
1818
const { resolve, dirname } = require('path');
1919
const { setTimeout } = require('timers');
2020

21-
2221
const supportsRecursiveWatching = process.platform === 'win32' ||
2322
process.platform === 'darwin';
2423

@@ -41,7 +40,9 @@ class FilesWatcher extends EventEmitter {
4140
this.#mode = mode;
4241
this.#signal = signal;
4342

44-
signal?.addEventListener('abort', () => this.clear(), { __proto__: null, once: true });
43+
if (signal) {
44+
EventEmitter.addAbortListener(signal, () => this.clear());
45+
}
4546
}
4647

4748
#isPathWatched(path) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.