Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1742,14 +1742,6 @@ changes:

Enable experimental WebAssembly System Interface (WASI) support.

### `--experimental-web-worker`

<!-- YAML
added: v26.9.0
-->

Enable experimental support for the Web Worker API.

### `--experimental-worker-inspection`

<!-- YAML
Expand Down Expand Up @@ -2368,6 +2360,20 @@ changes:

Disable the experimental [`node:vfs`][] module and `--vfs-load`.

### `--no-experimental-web-worker`

<!-- YAML
added: v26.9.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/65323
description: This feature is now enabled by default.
-->

> Stability: 1.1 - Active Development

Disable support for the Web Worker API.

### `--no-experimental-webstorage`

<!-- YAML
Expand Down Expand Up @@ -4291,7 +4297,6 @@ one is included in the list below.
* `--experimental-top-level-await`
* `--experimental-vm-modules`
* `--experimental-wasi-unstable-preview1`
* `--experimental-web-worker`
* `--experimental-websocket`
* `--force-context-aware`
* `--force-fips`
Expand Down Expand Up @@ -4324,6 +4329,7 @@ one is included in the list below.
* `--no-experimental-sqlite`
* `--no-experimental-strip-types`
* `--no-experimental-vfs`
* `--no-experimental-web-worker`
* `--no-experimental-webstorage`
* `--no-extra-info-on-fatal-exception`
* `--no-force-async-hooks-checks`
Expand Down
10 changes: 7 additions & 3 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,14 @@ A browser-compatible implementation of {WebSocket}.

<!-- YAML
added: v26.9.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/65323
description: This feature is now enabled by default.
-->

> Stability: 1 - Experimental. Enable this API with the
> [`--experimental-web-worker`][] CLI flag.
> Stability: 1 - Experimental. Disable this API with the
> [`--no-experimental-web-worker`][] CLI flag.

A mostly browser-compatible implementation of Web Workers of the [HTML Standard][],
implemented on top of [`node:worker_threads`][]. Threads created with it
Expand Down Expand Up @@ -1475,9 +1479,9 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
[Refable protocol]: process.md#processrefmayberefable
[Web Crypto API]: webcrypto.md
[`--experimental-eventsource`]: cli.md#--experimental-eventsource
[`--experimental-web-worker`]: cli.md#--experimental-web-worker
[`--localstorage-file`]: cli.md#--localstorage-filefile
[`--no-experimental-global-navigator`]: cli.md#--no-experimental-global-navigator
[`--no-experimental-web-worker`]: cli.md#--no-experimental-web-worker
[`--no-experimental-webstorage`]: cli.md#--no-experimental-webstorage
[`ByteLengthQueuingStrategy`]: webstreams.md#class-bytelengthqueuingstrategy
[`CompressionStream`]: webstreams.md#class-compressionstream
Expand Down
10 changes: 5 additions & 5 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,6 @@ Enable experimental ES Module support in the \fBnode:vm\fR module.
.It Fl -experimental-wasi-unstable-preview1
Enable experimental WebAssembly System Interface (WASI) support.
.
.It Fl -experimental-web-worker
Enable experimental support for the Web Worker API.
.
.It Fl -experimental-worker-inspection
Enable experimental support for the worker inspection with Chrome DevTools.
.
Expand Down Expand Up @@ -1235,6 +1232,9 @@ Disable the experimental \fBnode:sqlite\fR module.
.It Fl -no-experimental-vfs
Disable the experimental \fBnode:vfs\fR module and \fB--vfs-load\fR.
.
.It Fl -no-experimental-web-worker
Disable support for the Web Worker API.
.
.It Fl -no-experimental-webstorage
Disable \fBWeb Storage\fR support.
.
Expand Down Expand Up @@ -2281,8 +2281,6 @@ one is included in the list below.
.It
\fB--experimental-wasi-unstable-preview1\fR
.It
\fB--experimental-web-worker\fR
.It
\fB--experimental-websocket\fR
.It
\fB--force-context-aware\fR
Expand Down Expand Up @@ -2347,6 +2345,8 @@ one is included in the list below.
.It
\fB--no-experimental-vfs\fR
.It
\fB--no-experimental-web-worker\fR
.It
\fB--no-experimental-webstorage\fR
.It
\fB--no-extra-info-on-fatal-exception\fR
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental Web Worker API",
BOOL_FIELD(experimental_web_worker),
kAllowedInEnvvar,
false);
true);
AddOption("--experimental-websocket", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-global-customevent", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-sqlite",
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class EnvironmentOptions : public Options {
DEFINE_BOOL_FIELD(experimental_bench) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_eventsource) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_ffi) = HAVE_FFI;
DEFINE_BOOL_FIELD(experimental_web_worker) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_web_worker) = true;
DEFINE_BOOL_FIELD(experimental_websocket) = true;
DEFINE_BOOL_FIELD(experimental_sqlite) = HAVE_SQLITE;
DEFINE_BOOL_FIELD(experimental_stream_iter) = EXPERIMENTALS_DEFAULT_VALUE;
Expand Down
6 changes: 1 addition & 5 deletions test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,7 @@ class WPTRunner {
this.resource = new ResourceLoader(path);
this.concurrency = concurrency;

// Since we need to prepare the Web Worker APIs
// in the harness that runs on all WPT workers,
// we enable the API globally. This has no practical
// effect on the non-web-worker tests, however.
this.flags = ['--experimental-web-worker'];
this.flags = [];
if (this.inspectBrk) {
this.flags.push('--inspect-brk=0');
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-common-wpt-allowed-rejections.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function check(backend, webWorker, {

let result;
const statuses = [];
const handle = backends[backend](['--experimental-web-worker'], workerData, {
const handle = backends[backend]([], workerData, {
message(message) {
if (message.type === 'result') {
statuses.push(message.result.status);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-common-wpt-backends.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const backendProbe = process.env.NODE_TEST_WPT_BACKEND_PROBE;

const harnessPath = fixtures.path('wpt', 'resources', 'testharness.js');
const specPath = fixtures.path('wpt-backends-spec.js');
const execArgv = ['--experimental-web-worker'];
const execArgv = [];

function payload(throws) {
return {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-common-wpt-webworker-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { Worker } = require('worker_threads');

const workerPath = path.join(__dirname, '../common/wpt/worker.js');
const harnessPath = fixtures.path('wpt', 'resources', 'testharness.js');
const execArgv = ['--experimental-web-worker'];
const execArgv = [];
const workerData = {
testRelativePath: 'workers/error-after-result.any.js',
wptRunner: path.join(__dirname, '../common/wpt.js'),
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-webworker-blob-module-url.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
10 changes: 10 additions & 0 deletions test/parallel/test-webworker-disabled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Flags: --no-experimental-web-worker
'use strict';

// The Web Worker API is enabled by default, but can be opted out of.
// Refs: https://github.com/nodejs/node/pull/65323

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

assert.strictEqual(typeof Worker, 'undefined');
13 changes: 13 additions & 0 deletions test/parallel/test-webworker-enabled-by-default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

// Regression test: the Web Worker API is enabled by default and must not
// require the `--experimental-web-worker` flag.
// Refs: https://github.com/nodejs/node/pull/65323

require('../common');
const assert = require('assert');
const { Worker: WorkerThread } = require('worker_threads');

assert.strictEqual(typeof Worker, 'function');
assert.strictEqual(Worker.name, 'Worker');
assert.notStrictEqual(Worker, WorkerThread);
1 change: 0 additions & 1 deletion test/parallel/test-webworker-importscripts-conversion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-webworker-postmessage-lifecycle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-webworker-postmessage-overloads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-webworker-ref-unref.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-webworker-typescript-disabled.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-web-worker --no-strip-types
// Flags: --no-strip-types
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-webworker-typescript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-spec-differences.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-web-worker
'use strict';

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