diff --git a/doc/api/cli.md b/doc/api/cli.md index f7b025c961fced..94fb6a940373ef 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1364,14 +1364,6 @@ added: v0.8.0 Silence deprecation warnings. -### `--no-experimental-global-customevent` - - - -Disable exposition of [CustomEvent Web API][] on the global scope. - ### `--no-experimental-global-navigator` -> Stability: 1 - Experimental. Disable this API with the -> [`--no-experimental-global-customevent`][] CLI flag. +> Stability: 2 - Stable @@ -1150,7 +1152,6 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. [Navigator API]: https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object [RFC 5646]: https://www.rfc-editor.org/rfc/rfc5646.txt [Web Crypto API]: webcrypto.md -[`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent [`--no-experimental-global-navigator`]: cli.md#--no-experimental-global-navigator [`--no-experimental-websocket`]: cli.md#--no-experimental-websocket [`AbortController`]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController diff --git a/doc/node.1 b/doc/node.1 index d3c9ce8981d886..d5d7ecc928ebe5 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -186,9 +186,6 @@ Enable code coverage in the test runner. .It Fl -no-experimental-websocket Disable experimental support for the WebSocket API. . -.It Fl -no-experimental-global-customevent -Disable exposition of the CustomEvent on the global scope. -. .It Fl -no-experimental-repl-await Disable top-level await keyword support in REPL. . diff --git a/lib/internal/bootstrap/web/exposed-wildcard.js b/lib/internal/bootstrap/web/exposed-wildcard.js index 7d9b75caab667f..d8f451edb01205 100644 --- a/lib/internal/bootstrap/web/exposed-wildcard.js +++ b/lib/internal/bootstrap/web/exposed-wildcard.js @@ -50,6 +50,7 @@ const { } = require('internal/event_target'); exposeInterface(globalThis, 'Event', Event); exposeInterface(globalThis, 'EventTarget', EventTarget); +exposeLazyInterfaces(globalThis, 'internal/event_target', ['CustomEvent']); // https://encoding.spec.whatwg.org/#textencoder // https://encoding.spec.whatwg.org/#textdecoder diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js index bb197a33e2c7ec..761d7ca5fdf8a1 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js @@ -28,7 +28,6 @@ const { } = require('internal/options'); const { reconnectZeroFillToggle } = require('internal/buffer'); const { - exposeInterface, exposeLazyInterfaces, defineReplaceableLazyAttribute, setupCoverageHooks, @@ -104,7 +103,6 @@ function prepareExecution(options) { setupNavigator(); setupWarningHandler(); setupWebsocket(); - setupCustomEvent(); setupCodeCoverage(); setupDebugEnv(); // Process initial diagnostic reporting configuration, if present. @@ -341,17 +339,6 @@ function setupCodeCoverage() { } } -// TODO(daeyeon): move this to internal/bootstrap/web/* when the CLI flag is -// removed. -function setupCustomEvent() { - if (getEmbedderOptions().noBrowserGlobals || - getOptionValue('--no-experimental-global-customevent')) { - return; - } - const { CustomEvent } = require('internal/event_target'); - exposeInterface(globalThis, 'CustomEvent', CustomEvent); -} - function setupStacktracePrinterOnSigint() { if (!getOptionValue('--trace-sigint')) { return; diff --git a/src/node_options.cc b/src/node_options.cc index 146812c89c74c2..c44a679341dc8a 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -402,11 +402,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { &EnvironmentOptions::experimental_websocket, kAllowedInEnvvar, true); - AddOption("--experimental-global-customevent", - "expose experimental CustomEvent on the global scope", - &EnvironmentOptions::experimental_global_customevent, - kAllowedInEnvvar, - true); + AddOption("--experimental-global-customevent", "", NoOp{}, kAllowedInEnvvar); AddOption("--experimental-global-navigator", "expose experimental Navigator API on the global scope", &EnvironmentOptions::experimental_global_navigator, diff --git a/src/node_options.h b/src/node_options.h index cf744f13cd8f59..c2c819b4953e8e 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -111,7 +111,6 @@ class EnvironmentOptions : public Options { bool enable_source_maps = false; bool experimental_fetch = true; bool experimental_websocket = true; - bool experimental_global_customevent = true; bool experimental_global_navigator = true; bool experimental_global_web_crypto = true; bool experimental_https_modules = false; diff --git a/test/common/globals.js b/test/common/globals.js index 7b5643a926d970..9741c0f5834054 100644 --- a/test/common/globals.js +++ b/test/common/globals.js @@ -79,6 +79,7 @@ const webIdlExposedWildcard = new Set([ 'TextDecoder', 'AbortController', 'AbortSignal', + 'CustomEvent', 'EventTarget', 'Event', 'URL', diff --git a/test/parallel/test-global-customevent-disabled.js b/test/parallel/test-global-customevent-disabled.js deleted file mode 100644 index 2e19a498a0c01d..00000000000000 --- a/test/parallel/test-global-customevent-disabled.js +++ /dev/null @@ -1,7 +0,0 @@ -// Flags: --no-experimental-global-customevent -'use strict'; - -require('../common'); -const { strictEqual } = require('node:assert'); - -strictEqual(typeof CustomEvent, 'undefined'); diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js index 0953617e20861d..4b41b51f904be1 100644 --- a/test/parallel/test-process-env-allowed-flags-are-documented.js +++ b/test/parallel/test-process-env-allowed-flags-are-documented.js @@ -100,6 +100,7 @@ assert(undocumented.delete('--debug-arraybuffer-allocations')); assert(undocumented.delete('--no-debug-arraybuffer-allocations')); assert(undocumented.delete('--es-module-specifier-resolution')); assert(undocumented.delete('--experimental-fetch')); +assert(undocumented.delete('--experimental-global-customevent')); assert(undocumented.delete('--experimental-global-webcrypto')); assert(undocumented.delete('--experimental-report')); assert(undocumented.delete('--experimental-worker'));