Skip to content

Commit a8b26d7

Browse files
committed
lib: unflag AbortController
It's still experimental, but make the flag non-op Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #33527 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 74ca960 commit a8b26d7

File tree

9 files changed

+16
-41
lines changed

9 files changed

+16
-41
lines changed

doc/api/cli.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,14 @@ Currently, overriding `Error.prepareStackTrace` is ignored when the
170170
### `--experimental-abortcontroller`
171171
<!-- YAML
172172
added: REPLACEME
173+
changes:
174+
- version: REPLACEME
175+
pr-url: https://github.com/nodejs/node/pull/33527
176+
description: --experimental-abortcontroller is no longer required.
173177
-->
174178

175-
Enable experimental `AbortController` and `AbortSignal` support.
179+
Experimental `AbortController` and `AbortSignal` support is enabled by default.
180+
Use of this command line flag is no longer required.
176181

177182
### `--experimental-import-meta-resolve`
178183
<!-- YAML

doc/api/globals.md

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ added: REPLACEME
2929
A utility class used to signal cancelation in selected `Promise`-based APIs.
3030
The API is based on the Web API [`AbortController`][].
3131

32-
To use, launch Node.js using the `--experimental-abortcontroller` flag.
33-
3432
```js
3533
const ac = new AbortController();
3634

doc/node.1

-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ Enable FIPS-compliant crypto at startup.
118118
Requires Node.js to be built with
119119
.Sy ./configure --openssl-fips .
120120
.
121-
.It Fl -experimental-abortcontroller
122-
Enable experimental AbortController and AbortSignal support.
123-
.
124121
.It Fl -enable-source-maps
125122
Enable experimental Source Map V3 support for stack traces.
126123
.

lib/internal/bootstrap/node.js

+7
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ if (!config.noBrowserGlobals) {
133133
// https://encoding.spec.whatwg.org/#textdecoder
134134
exposeInterface(global, 'TextDecoder', TextDecoder);
135135

136+
const {
137+
AbortController,
138+
AbortSignal,
139+
} = require('internal/abort_controller');
140+
exposeInterface(global, 'AbortController', AbortController);
141+
exposeInterface(global, 'AbortSignal', AbortSignal);
142+
136143
// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
137144
const timers = require('timers');
138145
defineOperation(global, 'clearInterval', timers.clearInterval);

lib/internal/bootstrap/pre_execution.js

-27
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const {
44
Map,
55
ObjectDefineProperty,
6-
ObjectDefineProperties,
76
SafeWeakMap,
87
} = primordials;
98

@@ -54,7 +53,6 @@ function prepareMainThreadExecution(expandArgv1 = false) {
5453
// (including preload modules).
5554
initializeClusterIPC();
5655

57-
initializeAbortController();
5856
initializeDeprecations();
5957
initializeWASI();
6058
initializeCJSLoader();
@@ -306,30 +304,6 @@ function initializeDeprecations() {
306304
});
307305
}
308306

309-
function initializeAbortController() {
310-
const abortController = getOptionValue('--experimental-abortcontroller');
311-
if (abortController) {
312-
const {
313-
AbortController,
314-
AbortSignal
315-
} = require('internal/abort_controller');
316-
ObjectDefineProperties(global, {
317-
AbortController: {
318-
writable: true,
319-
enumerable: false,
320-
configurable: true,
321-
value: AbortController
322-
},
323-
AbortSignal: {
324-
writable: true,
325-
enumerable: false,
326-
configurable: true,
327-
value: AbortSignal
328-
}
329-
});
330-
}
331-
}
332-
333307
function setupChildProcessIpcChannel() {
334308
if (process.env.NODE_CHANNEL_FD) {
335309
const assert = require('internal/assert');
@@ -464,7 +438,6 @@ module.exports = {
464438
setupWarningHandler,
465439
setupDebugEnv,
466440
prepareMainThreadExecution,
467-
initializeAbortController,
468441
initializeDeprecations,
469442
initializeESMLoader,
470443
initializeFrozenIntrinsics,

lib/internal/main/worker_thread.js

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const {
1313
setupInspectorHooks,
1414
setupWarningHandler,
1515
setupDebugEnv,
16-
initializeAbortController,
1716
initializeDeprecations,
1817
initializeWASI,
1918
initializeCJSLoader,
@@ -113,7 +112,6 @@ port.on('message', (message) => {
113112
if (manifestSrc) {
114113
require('internal/process/policy').setup(manifestSrc, manifestURL);
115114
}
116-
initializeAbortController();
117115
initializeDeprecations();
118116
initializeWASI();
119117
initializeCJSLoader();

src/node_options.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
274274
"experimental Source Map V3 support",
275275
&EnvironmentOptions::enable_source_maps,
276276
kAllowedInEnvironment);
277-
AddOption("--experimental-abortcontroller",
278-
"experimental AbortController support",
279-
&EnvironmentOptions::experimental_abortcontroller,
280-
kAllowedInEnvironment);
277+
AddOption("--experimental-abortcontroller", "",
278+
NoOp{}, kAllowedInEnvironment);
281279
AddOption("--experimental-json-modules",
282280
"experimental JSON interop support for the ES Module loader",
283281
&EnvironmentOptions::experimental_json_modules,

src/node_options.h

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class EnvironmentOptions : public Options {
101101
public:
102102
bool abort_on_uncaught_exception = false;
103103
bool enable_source_maps = false;
104-
bool experimental_abortcontroller = false;
105104
bool experimental_json_modules = false;
106105
bool experimental_modules = false;
107106
std::string experimental_specifier_resolution;

test/parallel/test-abortcontroller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --no-warnings --experimental-abortcontroller
1+
// Flags: --no-warnings
22
'use strict';
33

44
const common = require('../common');

0 commit comments

Comments
 (0)