Skip to content

Commit

Permalink
lib: unflag AbortController
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jasnell committed Jun 5, 2020
1 parent 74ca960 commit a8b26d7
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 41 deletions.
7 changes: 6 additions & 1 deletion doc/api/cli.md
Expand Up @@ -170,9 +170,14 @@ Currently, overriding `Error.prepareStackTrace` is ignored when the
### `--experimental-abortcontroller`
<!-- YAML
added: REPLACEME
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/33527
description: --experimental-abortcontroller is no longer required.
-->

Enable experimental `AbortController` and `AbortSignal` support.
Experimental `AbortController` and `AbortSignal` support is enabled by default.
Use of this command line flag is no longer required.

### `--experimental-import-meta-resolve`
<!-- YAML
Expand Down
2 changes: 0 additions & 2 deletions doc/api/globals.md
Expand Up @@ -29,8 +29,6 @@ added: REPLACEME
A utility class used to signal cancelation in selected `Promise`-based APIs.
The API is based on the Web API [`AbortController`][].

To use, launch Node.js using the `--experimental-abortcontroller` flag.

```js
const ac = new AbortController();

Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Expand Up @@ -118,9 +118,6 @@ Enable FIPS-compliant crypto at startup.
Requires Node.js to be built with
.Sy ./configure --openssl-fips .
.
.It Fl -experimental-abortcontroller
Enable experimental AbortController and AbortSignal support.
.
.It Fl -enable-source-maps
Enable experimental Source Map V3 support for stack traces.
.
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/bootstrap/node.js
Expand Up @@ -133,6 +133,13 @@ if (!config.noBrowserGlobals) {
// https://encoding.spec.whatwg.org/#textdecoder
exposeInterface(global, 'TextDecoder', TextDecoder);

const {
AbortController,
AbortSignal,
} = require('internal/abort_controller');
exposeInterface(global, 'AbortController', AbortController);
exposeInterface(global, 'AbortSignal', AbortSignal);

// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
const timers = require('timers');
defineOperation(global, 'clearInterval', timers.clearInterval);
Expand Down
27 changes: 0 additions & 27 deletions lib/internal/bootstrap/pre_execution.js
Expand Up @@ -3,7 +3,6 @@
const {
Map,
ObjectDefineProperty,
ObjectDefineProperties,
SafeWeakMap,
} = primordials;

Expand Down Expand Up @@ -54,7 +53,6 @@ function prepareMainThreadExecution(expandArgv1 = false) {
// (including preload modules).
initializeClusterIPC();

initializeAbortController();
initializeDeprecations();
initializeWASI();
initializeCJSLoader();
Expand Down Expand Up @@ -306,30 +304,6 @@ function initializeDeprecations() {
});
}

function initializeAbortController() {
const abortController = getOptionValue('--experimental-abortcontroller');
if (abortController) {
const {
AbortController,
AbortSignal
} = require('internal/abort_controller');
ObjectDefineProperties(global, {
AbortController: {
writable: true,
enumerable: false,
configurable: true,
value: AbortController
},
AbortSignal: {
writable: true,
enumerable: false,
configurable: true,
value: AbortSignal
}
});
}
}

function setupChildProcessIpcChannel() {
if (process.env.NODE_CHANNEL_FD) {
const assert = require('internal/assert');
Expand Down Expand Up @@ -464,7 +438,6 @@ module.exports = {
setupWarningHandler,
setupDebugEnv,
prepareMainThreadExecution,
initializeAbortController,
initializeDeprecations,
initializeESMLoader,
initializeFrozenIntrinsics,
Expand Down
2 changes: 0 additions & 2 deletions lib/internal/main/worker_thread.js
Expand Up @@ -13,7 +13,6 @@ const {
setupInspectorHooks,
setupWarningHandler,
setupDebugEnv,
initializeAbortController,
initializeDeprecations,
initializeWASI,
initializeCJSLoader,
Expand Down Expand Up @@ -113,7 +112,6 @@ port.on('message', (message) => {
if (manifestSrc) {
require('internal/process/policy').setup(manifestSrc, manifestURL);
}
initializeAbortController();
initializeDeprecations();
initializeWASI();
initializeCJSLoader();
Expand Down
6 changes: 2 additions & 4 deletions src/node_options.cc
Expand Up @@ -274,10 +274,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental Source Map V3 support",
&EnvironmentOptions::enable_source_maps,
kAllowedInEnvironment);
AddOption("--experimental-abortcontroller",
"experimental AbortController support",
&EnvironmentOptions::experimental_abortcontroller,
kAllowedInEnvironment);
AddOption("--experimental-abortcontroller", "",
NoOp{}, kAllowedInEnvironment);
AddOption("--experimental-json-modules",
"experimental JSON interop support for the ES Module loader",
&EnvironmentOptions::experimental_json_modules,
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Expand Up @@ -101,7 +101,6 @@ class EnvironmentOptions : public Options {
public:
bool abort_on_uncaught_exception = false;
bool enable_source_maps = false;
bool experimental_abortcontroller = false;
bool experimental_json_modules = false;
bool experimental_modules = false;
std::string experimental_specifier_resolution;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-abortcontroller.js
@@ -1,4 +1,4 @@
// Flags: --no-warnings --experimental-abortcontroller
// Flags: --no-warnings
'use strict';

const common = require('../common');
Expand Down

0 comments on commit a8b26d7

Please sign in to comment.