mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
lib: enable global CustomEvent by default
Refs: https://github.com/nodejs/node/pull/43885 Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: https://github.com/nodejs/node/pull/44860 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
a2fb3f9785
commit
80270994d6
10 changed files with 32 additions and 24 deletions
|
@ -341,16 +341,6 @@ when `Error.stack` is accessed. If you access `Error.stack` frequently
|
||||||
in your application, take into account the performance implications
|
in your application, take into account the performance implications
|
||||||
of `--enable-source-maps`.
|
of `--enable-source-maps`.
|
||||||
|
|
||||||
### `--experimental-global-customevent`
|
|
||||||
|
|
||||||
<!-- YAML
|
|
||||||
added:
|
|
||||||
- v18.7.0
|
|
||||||
- v16.17.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
Expose the [CustomEvent Web API][] on the global scope.
|
|
||||||
|
|
||||||
### `--experimental-import-meta-resolve`
|
### `--experimental-import-meta-resolve`
|
||||||
|
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
|
@ -411,6 +401,14 @@ added: REPLACEME
|
||||||
|
|
||||||
Disable exposition of [Web Crypto API][] on the global scope.
|
Disable exposition of [Web Crypto API][] on the global scope.
|
||||||
|
|
||||||
|
### `--no-experimental-global-customevent`
|
||||||
|
|
||||||
|
<!-- YAML
|
||||||
|
added: REPLACEME
|
||||||
|
-->
|
||||||
|
|
||||||
|
Disable exposition of [CustomEvent Web API][] on the global scope.
|
||||||
|
|
||||||
### `--no-experimental-repl-await`
|
### `--no-experimental-repl-await`
|
||||||
|
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
|
@ -1829,7 +1827,6 @@ Node.js options that are allowed are:
|
||||||
* `--enable-fips`
|
* `--enable-fips`
|
||||||
* `--enable-source-maps`
|
* `--enable-source-maps`
|
||||||
* `--experimental-abortcontroller`
|
* `--experimental-abortcontroller`
|
||||||
* `--experimental-global-customevent`
|
|
||||||
* `--experimental-import-meta-resolve`
|
* `--experimental-import-meta-resolve`
|
||||||
* `--experimental-json-modules`
|
* `--experimental-json-modules`
|
||||||
* `--experimental-loader`
|
* `--experimental-loader`
|
||||||
|
@ -1862,6 +1859,7 @@ Node.js options that are allowed are:
|
||||||
* `--no-addons`
|
* `--no-addons`
|
||||||
* `--no-deprecation`
|
* `--no-deprecation`
|
||||||
* `--no-experimental-fetch`
|
* `--no-experimental-fetch`
|
||||||
|
* `--no-experimental-global-customevent`
|
||||||
* `--no-experimental-global-webcrypto`
|
* `--no-experimental-global-webcrypto`
|
||||||
* `--no-experimental-repl-await`
|
* `--no-experimental-repl-await`
|
||||||
* `--no-extra-info-on-fatal-exception`
|
* `--no-extra-info-on-fatal-exception`
|
||||||
|
|
|
@ -400,10 +400,14 @@ only if the Node.js binary was compiled with including support for the
|
||||||
added:
|
added:
|
||||||
- v18.7.0
|
- v18.7.0
|
||||||
- v16.17.0
|
- v16.17.0
|
||||||
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/44860
|
||||||
|
description: No longer behind `--experimental-global-customevent` CLI flag.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
> Stability: 1 - Experimental. Enable this API with the
|
> Stability: 1 - Experimental. Disable this API with the
|
||||||
> [`--experimental-global-customevent`][] CLI flag.
|
> [`--no-experimental-global-customevent`][] CLI flag.
|
||||||
|
|
||||||
<!-- type=global -->
|
<!-- type=global -->
|
||||||
|
|
||||||
|
@ -947,8 +951,8 @@ added: v18.0.0
|
||||||
A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
|
A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
|
||||||
|
|
||||||
[Web Crypto API]: webcrypto.md
|
[Web Crypto API]: webcrypto.md
|
||||||
[`--experimental-global-customevent`]: cli.md#--experimental-global-customevent
|
|
||||||
[`--no-experimental-fetch`]: cli.md#--no-experimental-fetch
|
[`--no-experimental-fetch`]: cli.md#--no-experimental-fetch
|
||||||
|
[`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent
|
||||||
[`--no-experimental-global-webcrypto`]: cli.md#--no-experimental-global-webcrypto
|
[`--no-experimental-global-webcrypto`]: cli.md#--no-experimental-global-webcrypto
|
||||||
[`AbortController`]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
[`AbortController`]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
||||||
[`ByteLengthQueuingStrategy`]: webstreams.md#class-bytelengthqueuingstrategy
|
[`ByteLengthQueuingStrategy`]: webstreams.md#class-bytelengthqueuingstrategy
|
||||||
|
|
|
@ -139,9 +139,6 @@ Requires Node.js to be built with
|
||||||
.It Fl -enable-source-maps
|
.It Fl -enable-source-maps
|
||||||
Enable Source Map V3 support for stack traces.
|
Enable Source Map V3 support for stack traces.
|
||||||
.
|
.
|
||||||
.It Fl -experimental-global-customevent
|
|
||||||
Expose the CustomEvent on the global scope.
|
|
||||||
.
|
|
||||||
.It Fl -experimental-global-webcrypto
|
.It Fl -experimental-global-webcrypto
|
||||||
Expose the Web Crypto API on the global scope.
|
Expose the Web Crypto API on the global scope.
|
||||||
.
|
.
|
||||||
|
@ -165,6 +162,9 @@ Use this flag to enable ShadowRealm support.
|
||||||
.It Fl -no-experimental-fetch
|
.It Fl -no-experimental-fetch
|
||||||
Disable experimental support for the Fetch API.
|
Disable experimental support for the Fetch API.
|
||||||
.
|
.
|
||||||
|
.It Fl -no-experimental-global-customevent
|
||||||
|
Disable exposition of the CustomEvent on the global scope.
|
||||||
|
.
|
||||||
.It Fl -no-experimental-global-webcrypto
|
.It Fl -no-experimental-global-webcrypto
|
||||||
Disable exposition of the Web Crypto API on the global scope.
|
Disable exposition of the Web Crypto API on the global scope.
|
||||||
.
|
.
|
||||||
|
|
|
@ -278,7 +278,7 @@ function setupWebCrypto() {
|
||||||
// removed.
|
// removed.
|
||||||
function setupCustomEvent() {
|
function setupCustomEvent() {
|
||||||
if (process.config.variables.node_no_browser_globals ||
|
if (process.config.variables.node_no_browser_globals ||
|
||||||
!getOptionValue('--experimental-global-customevent')) {
|
getOptionValue('--no-experimental-global-customevent')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { CustomEvent } = require('internal/event_target');
|
const { CustomEvent } = require('internal/event_target');
|
||||||
|
|
|
@ -358,7 +358,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
||||||
AddOption("--experimental-global-customevent",
|
AddOption("--experimental-global-customevent",
|
||||||
"expose experimental CustomEvent on the global scope",
|
"expose experimental CustomEvent on the global scope",
|
||||||
&EnvironmentOptions::experimental_global_customevent,
|
&EnvironmentOptions::experimental_global_customevent,
|
||||||
kAllowedInEnvironment);
|
kAllowedInEnvironment,
|
||||||
|
true);
|
||||||
AddOption("--experimental-global-webcrypto",
|
AddOption("--experimental-global-webcrypto",
|
||||||
"expose experimental Web Crypto API on the global scope",
|
"expose experimental Web Crypto API on the global scope",
|
||||||
&EnvironmentOptions::experimental_global_web_crypto,
|
&EnvironmentOptions::experimental_global_web_crypto,
|
||||||
|
|
|
@ -109,7 +109,7 @@ class EnvironmentOptions : public Options {
|
||||||
std::string dns_result_order;
|
std::string dns_result_order;
|
||||||
bool enable_source_maps = false;
|
bool enable_source_maps = false;
|
||||||
bool experimental_fetch = true;
|
bool experimental_fetch = true;
|
||||||
bool experimental_global_customevent = false;
|
bool experimental_global_customevent = true;
|
||||||
bool experimental_global_web_crypto = true;
|
bool experimental_global_web_crypto = true;
|
||||||
bool experimental_https_modules = false;
|
bool experimental_https_modules = false;
|
||||||
bool experimental_wasm_modules = false;
|
bool experimental_wasm_modules = false;
|
||||||
|
|
7
test/parallel/test-global-customevent-disabled.js
Normal file
7
test/parallel/test-global-customevent-disabled.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Flags: --no-experimental-global-customevent
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
require('../common');
|
||||||
|
const { strictEqual } = require('node:assert');
|
||||||
|
|
||||||
|
strictEqual(typeof CustomEvent, 'undefined');
|
|
@ -1,4 +1,4 @@
|
||||||
// Flags: --experimental-global-customevent --expose-internals
|
// Flags: --expose-internals
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
|
|
|
@ -405,7 +405,7 @@ putIn.run([
|
||||||
'var custom = "test";',
|
'var custom = "test";',
|
||||||
]);
|
]);
|
||||||
testMe.complete('cus', common.mustCall(function(error, data) {
|
testMe.complete('cus', common.mustCall(function(error, data) {
|
||||||
assert.deepStrictEqual(data, [['custom'], 'cus']);
|
assert.deepStrictEqual(data, [['CustomEvent', 'custom'], 'cus']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Make sure tab completion doesn't crash REPL with half-baked proxy objects.
|
// Make sure tab completion doesn't crash REPL with half-baked proxy objects.
|
||||||
|
|
|
@ -4,6 +4,4 @@ const { WPTRunner } = require('../common/wpt');
|
||||||
|
|
||||||
const runner = new WPTRunner('dom/events');
|
const runner = new WPTRunner('dom/events');
|
||||||
|
|
||||||
runner.setFlags(['--experimental-global-customevent']);
|
|
||||||
|
|
||||||
runner.runJsTests();
|
runner.runJsTests();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue