Skip to content
Permalink
Browse files

worker: partially remove `--experimental-worker` flag

This is a trimmed-down version of 63d4cae that avoids
backporting pain for v11.x. The remainder of the original commit
can be cherry-picked later, once other PRs have been backported first.

PR-URL: #25404
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

--- Original commit message ---

Having an experimental feature behind a flag makes change
if we are expecting significant breaking changes to its API.

Since the Worker API has been essentially stable since
its initial introduction, and no noticeable doubt about
possibly not keeping the feature around has been voiced,
removing the flag and thereby reducing the barrier to experimentation,
and consequently receiving feedback on the implementation,
seems like a good idea.

Refs: #25361
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information...
addaleax authored and BridgeAR committed Jan 6, 2019
1 parent 7bb7b9a commit 65c136f3deeeaf8f03ccd42d634fce53d67e1211
Showing with 15 additions and 68 deletions.
  1. +1 −1 benchmark/misc/startup.js
  2. +1 −1 benchmark/worker/echo.js
  3. +0 −8 doc/api/cli.md
  4. +1 −1 doc/api/worker_threads.md
  5. +0 −3 doc/node.1
  6. +1 −2 test/abort/test-addon-uv-handle-leak.js
  7. +0 −1 test/addons/hello-world/test-worker.js
  8. +0 −2 test/addons/worker-addon/test.js
  9. +0 −1 test/parallel/test-async-wrap-missing-method.js
  10. +1 −1 test/parallel/test-heapdump-worker.js
  11. +1 −1 test/parallel/test-module-cjs-helpers.js
  12. +0 −1 test/parallel/test-trace-events-api-worker-disabled.js
  13. +0 −1 test/parallel/test-trace-events-dynamic-enable-workers-disabled.js
  14. +1 −3 test/parallel/test-trace-events-worker-metadata.js
  15. +0 −1 test/parallel/test-v8-coverage.js
  16. +0 −1 test/parallel/test-worker-cleanup-handles.js
  17. +2 −3 test/parallel/test-worker-debug.js
  18. +0 −1 test/parallel/test-worker-dns-terminate.js
  19. +1 −1 test/parallel/test-worker-esmodule.js
  20. +0 −1 test/parallel/test-worker-exit-code.js
  21. +0 −1 test/parallel/test-worker-invalid-workerdata.js
  22. +0 −1 test/parallel/test-worker-memory.js
  23. +1 −1 test/parallel/test-worker-message-channel-sharedarraybuffer.js
  24. +0 −1 test/parallel/test-worker-message-channel.js
  25. +0 −1 test/parallel/test-worker-message-port-arraybuffer.js
  26. +0 −1 test/parallel/test-worker-message-port-drain.js
  27. +0 −1 test/parallel/test-worker-message-port-message-port-transferring.js
  28. +0 −1 test/parallel/test-worker-message-port-transfer-closed.js
  29. +0 −1 test/parallel/test-worker-message-port-transfer-self.js
  30. +0 −1 test/parallel/test-worker-message-port-transfer-target.js
  31. +0 −1 test/parallel/test-worker-message-port-wasm-module.js
  32. +1 −1 test/parallel/test-worker-message-port-wasm-threads.js
  33. +0 −1 test/parallel/test-worker-message-port.js
  34. +0 −1 test/parallel/test-worker-messageport-transfer-terminate.js
  35. +0 −1 test/parallel/test-worker-nexttick-terminate.js
  36. +0 −1 test/parallel/test-worker-onmessage-not-a-function.js
  37. +0 −1 test/parallel/test-worker-onmessage.js
  38. +0 −1 test/parallel/test-worker-parent-port-ref.js
  39. +0 −1 test/parallel/test-worker-relative-path-double-dot.js
  40. +0 −1 test/parallel/test-worker-relative-path.js
  41. +0 −1 test/parallel/test-worker-stdio.js
  42. +0 −1 test/parallel/test-worker-syntax-error-file.js
  43. +0 −1 test/parallel/test-worker-syntax-error.js
  44. +0 −1 test/parallel/test-worker-type-check.js
  45. +0 −1 test/parallel/test-worker-uncaught-exception-async.js
  46. +0 −1 test/parallel/test-worker-uncaught-exception.js
  47. +0 −1 test/parallel/test-worker-unsupported-path.js
  48. +0 −1 test/parallel/test-worker-unsupported-things.js
  49. +1 −1 test/parallel/test-worker-workerdata-sharedarraybuffer.js
  50. +0 −1 test/parallel/test-worker.js
  51. +1 −1 test/wpt/test-console.js
  52. +1 −1 test/wpt/test-url.js
  53. +0 −1 tools/test.py
@@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
mode: ['process', 'worker']
}, {
flags: ['--expose-internals', '--experimental-worker'] // for workers
flags: ['--expose-internals']
});

function spawnProcess(script) {
@@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
n: [1e5]
}, { flags: ['--experimental-worker'] });
});

const workerPath = path.resolve(__dirname, '..', 'fixtures', 'echo.worker.js');

@@ -104,13 +104,6 @@ added: v9.6.0

Enable experimental ES Module support in the `vm` module.

### `--experimental-worker`
<!-- YAML
added: v10.5.0
-->

Enable experimental worker threads using the `worker_threads` module.

### `--force-fips`
<!-- YAML
added: v6.0.0
@@ -604,7 +597,6 @@ Node.js options that are allowed are:
- `--experimental-modules`
- `--experimental-repl-await`
- `--experimental-vm-modules`
- `--experimental-worker`
- `--force-fips`
- `--icu-data-dir`
- `--inspect`
@@ -6,7 +6,7 @@
The `worker` module provides a way to create multiple environments running
on independent threads, and to create message channels between them. It
can be accessed using the `--experimental-worker` flag and:
can be accessed using:

```js
const worker = require('worker_threads');
@@ -94,9 +94,6 @@ keyword support in REPL.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.
.It Fl -experimental-worker
Enable experimental worker threads using worker_threads module.
.
.It Fl -force-fips
Force FIPS-compliant crypto on startup
(Cannot be disabled from script code).
@@ -36,8 +36,7 @@ if (process.argv[2] === 'child') {
binding.leakHandle(0x42);
`, { eval: true });
} else {
const child = cp.spawnSync(process.execPath,
['--experimental-worker', __filename, 'child']);
const child = cp.spawnSync(process.execPath, [__filename, 'child']);
const stderr = child.stderr.toString();

assert.strictEqual(child.stdout.toString(), '');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
@@ -11,7 +10,6 @@ if (process.argv[2] === 'child') {
new Worker(`require(${JSON.stringify(binding)});`, { eval: true });
} else {
const proc = child_process.spawnSync(process.execPath, [
'--experimental-worker',
__filename,
'child'
]);
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,4 @@
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
'use strict';
require('../common');
const { validateSnapshotNodes } = require('../common/heap');
@@ -1,5 +1,5 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -15,8 +14,7 @@ if (isMainThread) {
process.chdir(tmpdir.path);

const proc = cp.spawn(process.execPath,
[ '--experimental-worker',
'--trace-event-categories', 'node',
[ '--trace-event-categories', 'node',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(fs.existsSync(FILE_NAME));
@@ -83,7 +83,6 @@ function nextdir() {
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
const output = spawnSync(process.execPath, [
'--experimental-worker',
require.resolve('../fixtures/v8-coverage/worker')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

@@ -154,9 +153,9 @@ async function testBasicWorkerDebug(session, post) {
await workerSession.post('Debugger.enable');
await workerSession.post('Runtime.enable');
await workerSession.waitForBreakAfterCommand(
'Runtime.runIfWaitingForDebugger', __filename, 2);
'Runtime.runIfWaitingForDebugger', __filename, 1);
await workerSession.waitForBreakAfterCommand(
'Debugger.resume', __filename, 27); // V8 line number is zero-based
'Debugger.resume', __filename, 26); // V8 line number is zero-based
assert.strictEqual(await consolePromise, workerMessage);
workerSession.post('Debugger.resume');
await Promise.all([worker, detached, contextEvents]);
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-modules
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');

@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-wasm-threads
// Flags: --experimental-wasm-threads
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const { Worker, MessageChannel } = require('worker_threads');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
@@ -3,7 +3,6 @@
// listener from holding the event loop open. This test confirms that
// functionality.

// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker, parentPort } = require('worker_threads');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const assert = require('assert');
const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const path = require('path');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';

const common = require('../common');
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@@ -1,6 +1,6 @@
'use strict';

// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const { WPTRunner } = require('../common/wpt');
@@ -1,6 +1,6 @@
'use strict';

// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const { WPTRunner } = require('../common/wpt');
@@ -1588,7 +1588,6 @@ def Main():

if options.worker:
run_worker = join(workspace, "tools", "run-worker.js")
options.node_args.append('--experimental-worker')
options.node_args.append(run_worker)

shell = abspath(options.shell)

0 comments on commit 65c136f

Please sign in to comment.
You can’t perform that action at this time.