Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
5 changes: 5 additions & 0 deletions 5 docs/api/command-line-switches.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ Set the directory to which all Node.js diagnostic output files are written. Defa

Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).

### `--no-experimental-global-navigator`

Disable exposition of [Navigator API][] on the global scope from Node.js.

[app]: app.md
[append-switch]: command-line.md#commandlineappendswitchswitch-value
[debugging-main-process]: ../tutorial/debugging-main-process.md
Expand All @@ -331,3 +335,4 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
[ready]: app.md#event-ready
[severities]: https://source.chromium.org/chromium/chromium/src/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
[Navigator API]: https://github.com/nodejs/node/blob/main/doc/api/globals.md#navigator
1 change: 1 addition & 0 deletions 1 shell/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ bool IsAllowedOption(const std::string_view option) {
"--throw-deprecation",
"--trace-deprecation",
"--trace-warnings",
"--no-experimental-global-navigator",
});

if (debug_options.contains(option))
Expand Down
28 changes: 28 additions & 0 deletions 28 spec/api-utility-process-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,5 +780,33 @@ describe('utilityProcess module', () => {
expect(stat.size).to.be.greaterThan(0);
await fs.rm(tmpDir, { recursive: true });
});

it('supports --no-experimental-global-navigator flag', async () => {
{
const child = utilityProcess.fork(path.join(fixturesPath, 'navigator.js'), [], {
stdio: 'ignore'
});
await once(child, 'spawn');
const [data] = await once(child, 'message');
expect(data).to.be.true();
const exit = once(child, 'exit');
expect(child.kill()).to.be.true();
await exit;
}
{
const child = utilityProcess.fork(path.join(fixturesPath, 'navigator.js'), [], {
stdio: 'ignore',
execArgv: [
'--no-experimental-global-navigator'
]
});
await once(child, 'spawn');
const [data] = await once(child, 'message');
expect(data).to.be.false();
const exit = once(child, 'exit');
expect(child.kill()).to.be.true();
await exit;
}
});
});
});
1 change: 1 addition & 0 deletions 1 spec/fixtures/api/utility-process/navigator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.parentPort.postMessage(typeof navigator === 'object');
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.